Overview
Expected Effect
In actual business scenarios, you may need to select and download a report from specified reports, and customize the exported file name, as shown in the following figure.

Implementation Method
You can add a dropdown-box widget to the parameter panel, obtain the report storage path, add a button widget, and set a Click event for the button widget to export the report when the button is clicked.
Example
Template Parameter Adding
Create a general report, choose Template > Template Parameter on the menu bar, and add two template parameters: TABLE and NAME.

Widget Adding
Edit the parameter panel, and click Add All to add both parameters to the parameter panel, as shown in the following figure.

Widget Setting
(1) Change the widget value of the LabelTABLE widget to Select a Table:, and for the TABLE widget, set the widget type to Drop-down Box Widget, set Type to Custom in Data Dictionary, set Actual Value to the report path, and set Display Value to the report name. The following figure shows the settings.
Note:
(2) Change the widget value of the LabelNAME widget to Custom Name:, and for the NAME widget, set the widget type to Text Widget so that you can customize the name of the exported file.
(3) Delete the Query button.
(4) Drag in a button widget, change Button Name to Export to Excel, and add a Click event for the button widget with the following JavaScript (JS) code:
var tab = _g().getParameterContainer().getWidgetByName("TABLE").getValue();
var name = _g().getParameterContainer().getWidgetByName("NAME").getValue();
var pars = '&format=excel&extype=sheet&__filename__='+name;
window.location = "${servletURL}?viewlet=" + (tab+pars);
The following figure shows the operation steps.

(5) Select the Export to Excel button, duplicate it twice, and rename the new buttons to Export to Word and Export to PDF, respectively. Add a Click event for the button widgets with the above JS code, but replace excel in &format=excel with word and pdf, respectively.
Effect Preview
Save the template and click Pagination Preview. The effect is the same as that shown in the Expected Effect section.
Note:1. The value of Custom Name cannot be left empty.
2. The effect cannot be previewed on mobile terminals.
Template Download
Download the template by clicking Exporting Different Reports Based on Parameters.cpt.