How to change the exporting document file name based on parameter

To name an exported document after a report parameter value in the Bold Reports® Angular Report Viewer, build the file name in the onRenderingComplete event and assign it when the user clicks an export option. Follow these steps:

  1. Create the export file name from the parameters in the onRenderingComplete event and store it in a local variable.

    function onRenderingComplete(event) {
       var parameters = event.reportParameters;
       if(parameters){
       for (var i = 0; i < parameters.length; i++) {
         if(parameters[i].Name == "Department"){
           this.exportFileName = "Sales for " + parameters[i].Value;
         }
     }
  2. In the export item click event, set the file name property to the value stored in the local variable.

      function onExportItemClick(event) {
          event.fileName =  this. exportFileName ;
      }

See also