I. Overview
1. Version
Designer | JAR | Plugin version |
---|---|---|
10.0 | 2021-01-25 | 3.8.3 |
2. Application scenarios
Sometimes users need to export the dashboard in Excel, PDF, Word format for preview, they can download and install the "Export Dashboard Plugin" for implementation.
3. Function introduction
"Export Dashboard Plugin" supports the overall export of dashboards into Excel, PDF, and Word formats.
The unsupported function items are as follows:
1) The JAR package is version 2018-12-27 or later, and the plugin needs to be upgraded to version 3.0 or later, otherwise it cannot be exported.
2) Export widget is not supported.
3) Does not support exporting the body background; does not support the background and border set in the "style" of the exported component.
4) Does not support overlapping chart blocks or report blocks in dashboards.
5) Tab component only exports the first Tab page; turning pages only exports the current page.
6) If JAR package is before 2020-08-31, exporting Word does not support chart components, only supports cell element charts.
7) It cannot be enabled at the same time with the same type of plugins, such as: Export Dashboard Plus Plugin, Export Dashboard Multi-tab Page Plugin.
8) Mobile terminal is not supported.
II. Install the plugin
Click to download the plugin: fr-plugin-exportform-3.8.3.zip
Designer plugin installation method reference: Plugin Management
Server installation plugin method reference: Server plugin management
III. Export general dashboard
Export the dashboard to Excel, PDF, Word format as a whole, only need to add the suffix &op=export&format=xxx to the URL link in "PC Preview", and press "Enter" to export. xxx represents the exported format, as shown in the following table:
Note: To modify the file name, you can add the parameter &__filename__=filename
Format | Suffix |
---|---|
Excel | &op=export&format=excel |
Word | &op=export&format=word |
&op=export&format=pdf |
For example, export the dashboard to Excel, as shown in the figure below:
IV. Export dashboard with parameters
When the dashboard contains parameters, the content of the dashboard or the components in the dashboard will change due to changes in the parameters (such as parameter query, main sub-report, etc.). Then when you use URL to export the dashboard, you need to add sessionID to export the current query result, otherwise the exported content will be inconsistent with the parameter query content.
Note: The browser requests the Web service. When a session is created, the server will generate a separate session ID for each session. This session ID is the sessionID, which is returned as a long integer data type. sessionID is equal to the ID record of this session.
1. Add "After Initializational" event
Open the built-in template %FR_HOME%\webapps\webroot\WEB-INF\reportlets\Visit Statistics Dashboard.frm, select the parameter pane "para", add "After Initializational" event, set a parameter "aaa", select "Formula" and enter: sessionID. The steps are shown in the figure below:
The JS code is as follows:
alert(aaa);
2. Export by getting sessionID
1) Save the template, click "PC Preview", the current sessionID will pop up, after copying the current sessionID, click OK. As shown below:
Note: The sessionID will change every time it is refreshed.
2) When exporting, add the suffix &op=export&format=xxx&sessionID=***, xxx represents the exported file format, *** represents the current sessionID copied, and press "Enter" to export the current query result.
3. Preview effect
As shown below:
4. Download template
Completed template, please refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Dashboard\Export_dashboard_with_parameters.frm
Click to download: Export_dashboard_with_parameters.frm
V. Export dashboard with parameters by JS
Add a "Button" widget in the parameter panel(you can also add a button widget directly in the body), set the parameter "aaa" to get the current sessionID, and add a "Click" event to export.
1. Add a button
Open the built-in template %FR_HOME%\webapps\webroot\WEB-INF\reportlets\Visit Statistics Dashboard.frm, add "Button" widget in the parameter pane, and the button name is "Export Excel", as shown in the following figure:
2. Add an event
Select the "Button" widget, add a "Click" event, set a parameter "aaa", select the "Formula" and enter the formula: sessionID. As shown below:
The JavaScript code is as follows:
var REPORT_URL = '${servletURL}?viewlet=/Visit Statistics Dashboard.frm&op=export&format=excel&sessionID=' + aaa;
window.location = encodeURI(REPORT_URL);
Note: Modifying excel in "&format=excel" to pdf or word means exporting PDF or Word.
3. Preview effect
Save the template, click "PC Preview", click the "Query" button, and then click the "Export Excel" button. The effect is as follows:
Note: The user must preview the query first and get the query interface before exporting. If you export directly without querying, the data and effect of the exported file cannot be guaranteed.
4. Download template
Completed template, please refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Dashboard\Export_dashboard_with_parameters_by_JS.frm
Click to download: Export_dashboard_with_parameters_by_JS.frm