Overview
Version
| Report Server Version | Functional Change |
|---|---|
| 11.0 | / |
Application Scenario
Note:1. Currently, this function applies only to CPT reports.
2. This function does not apply to the templates with the new calculation engine enabled.
When exporting a template as a file, the filename defaults to the template name. To customize the name of the exported file, you typically need the JavaScript (JS) code.
However, JS has a certain learning curve, and JS code maintenance can be complex.
To address these issues, FineReport version 11.0 introduces an export event that allows you to customize filenames while selecting the types of exported files, eliminating the need for JS code.

Function Entry
Currently, this function applies only to CPT reports. A new event type called Export Event has been added to Click event types for widgets in CPT reports, as shown in the following figure.
This event enables file export and filename customization simultaneously.

Function Description
Export Setting
Export Template: By default, the current template is exported. You can also export other templates. You should select required templates from the report project directory, and you can select only general reports.
Export Way: Options include PDF Output, Excel Output, Word Output, and Image.
Export File Name: If you select Default, the template name will be used as the name of the exported file. If you select Custom, you can define the filename using formulas or strings. Formulas begin with an equal symbol in the edit box, while strings omit that equal symbol.
Note:1. When you customize the name of the exported file, special characters like \ / : * ? " | and spaces are not supported and will be automatically replaced with underscores.
2. When you use formulas for the customized name of the exported file, cell references and hierarchical coordinate functions are not supported.

Parameter
Inherit Report is selected by default. In this case, even if you do not click the query button, data filtered by the currently selected value of the parameter will also be exported.

If you deselect Inherit Report, you can customize parameters.

Example
Template Design
Open the built-in template GettingStarted.cpt in the path FineReport installation directory\webapps\webroot\WEB-INF\reportlets.
Event Adding
Drag a button widget into the parameter panel, rename it to Export the Template, and add a Click event of type Export Event.
Set Export Way to Excel Output (Unaltered Export), and use a formula to customize the filename: =$region + " " + "Regional Sales Overview", as shown in the following figure.

Effect Preview
Save the report and click Pagination Preview. The effect of file export is the same as that shown in the "Application Scenario" section.
The effect cannot be previewed on the DataAnalyst app and HTML5 terminal.
Template Download
Download the template by clicking Customizing the Name of the Exported File.cpt.