Md.
Md.

Reputation: 526

Jsreport XLSX recipie: Saving jsreport response to an excel file

I am trying to save the response received from jsreport API. How to save jsreport response to an excel file?

Upvotes: 1

Views: 383

Answers (1)

EngineerEthan
EngineerEthan

Reputation: 51

I am assuming you have a little knowledge of JSReport.

First of all, make sure that you set up your report to run as an excel report and that you have xlsx selected in the template type.

xlsxTemplate

I assume you've already done all of that.

Next, in the JSON object that you send to JSReport, you will probably have created something like this:

let dataOptions = { 
   template: { 
      shortid: 'xx2346kn' 
   }, 
   data: reportData 
}

Add an options property so that you end up with this:

let dataOptions = { 
    template: { 
        shortid: 'xx2346kn' 
    }, 
    data: reportData,
    options: {
        preview: true
    }
}

Assuming you've set everything else up correctly, this will

save jsreport response to an excel file

in your default downloads location.

Upvotes: 0

Related Questions