Customizing the Name of the Exported File

  • Last update:February 26, 2026
  • Overview

    Version

    Report Server VersionFunctional Change
    11.0/

    Application Scenario

    iconNote:

    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.

    效果.gif

    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.

    1.3 功能入口.png

    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.

    iconNote:

    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.

    2.1 导出设置.png

    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.

    2.2 参数.png

    If you deselect Inherit Report, you can customize parameters.

    2.2 参数(2.png

    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.

    3.2 添加事件.png

    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.

    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy