XLSX Recipe Corrupt excel output (email attachment)
-
Hi guys!
I am trying to send the generated report as an email attachment. However, in the email, the attached excel cannot be opened as it is corrupted/invalid format. I think, it is an file format/data encoding issue because file retrieved from reportResponse['headers']['permanent-link'] works fine.
Here is the code to send email attachment:function(reportError, reportResponse, reportBody){ attachments: [{ content: Buffer.from(reportResponse.body).toString('base64'), type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename: "report.xlsx", disposition: "attachment"}], }
Also, when I write the content to disk, I face the same issue:
require('fs').writeFileSync("D:\report.xlsx", reportResponse.body);Any idea?
In which format Jsreport stores the report content in reportResponse? binary?Thanks.
Nazmus