I. Overview
1. Version description
Report server version | Function changes |
---|---|
10.0.19 | There is an additional event type "Export Event" in the general report. Users can export the template to a file through this event and support customize export file name. |
2. Application scenarios
When the template is exported as a file, the file name defaults to the name of the template. If users want to customize the export file name, they usually need to use JavaScript code.
But on the one hand JavaScript has a certain threshold, on the other hand it is more complicated to maintain.
In response to the above problems, the 10.0.19 version adds an export event. You can customize the file name while selecting the export file type without using JavaScript code.
3. Function entrance
Currently, only .cpt reports are supported. A new type of widget event is added to the .cpt reports: "Export Event", as shown in the following figure:
This event can be realized at the same time: file export + customize file name.
II. Function introduction
1. Export settings
Export template: The default is to export the current template, or you can choose to export other templates. When you select other templates, you need to select them in the report project directory, and you can only select ordinary reports.
Export method: You can choose PDF export, Excel export, Word export, and picture export.
Export file name: If you select default, the file name is the template name.If you select custom, the use of formulas and strings are supported to define the file name, and the formula is the equal sign in front of the edit box, and the string just remove the equal sign in front of it.
Note: When customizing the export file name, some special symbols, cells, and hierarchical coordinate functions are not supported. For details, please refer to the red prompt text in the interface below.
2. Parameters
By default, Inherit Report Parameters is checked. At this time, it will be exported according to the current session parameters, that is, if the query is not clicked, the parameters selected in the current parameter pane will be used for export.
Uncheck Inherit Report Parameters, the user can customize the parameters.
III. Examples
1. Design template
Open the designer's built-in template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\GettingStarted.cpt
2. Add event
Drag a button widget in the parameter pane, rename it to Export Template, add a click event to the button, and select Export Event as the type.
Select Export Excel (export as is) as the export method, and the export file is customized with a formula: =$region + "area sales overview", as shown in the figure below:
3. Effect preview
After saving the report and click PC Preview, the effect of the exported file is shown in I.2. Application Scenarios.
App and HTML5 previews are not supported.
IV. Template download
For the completed template, see: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-en\SpecialSubject\Customize _Export_File_Name.cpt
Click to download the template:
Customize_Export_File_Name.cpt