XLSX file corrupted after download from JSreport using API
-
Hi
I am working through an API in Node.js posting requests to a jsreport.Using jsrender engine and xlsx recipe i am creating xlsx files from data in json format.
The problem is that , I get an error from excel:"We found a problem with some content in <filename> . Do you want us to recover as much as we can? If you trust the source of this workbook, click Yes"
If I do click Yes, an empty worksheet appears with the following error message:
Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
Removed Part: /xl/sharedStrings.xml part with XML error. (Strings) A document must contain exactly one root element. Line 1, column 0.
Removed Records: Cell information from /xl/worksheets/sheet1.xml partWhen the error occurs, I've tried taking the json file and using it as sample data in jsreport studio and the report comes out fine.
for reference i have uploaded the corrupted xlsx file.
[0_1532000403750_Report (6).xlsx](Uploading 100%)
-
Please try to upload the xlsx file again, it didn't make it through.
It would be the best if it is a minimal excel file, with one cell is the best :)
But I guess this is happening just with a complex one.
-
Hi,
Please download the file from the below link
https://drive.google.com/file/d/1J03DGmU9hdaLlARjO2fg3u3uX-7Tnamg/view?usp=sharing
-
This files is invalid zip. That is strange.
Are you able to replicate the issue locally?
Do you have some observations like that this is happening just for particular code?
Does the same happen also on the latest jsreport?So far I have no clue how it could happen that the output zip/xlsx is corrupted.
-
Hi,
Thanks for replay.
i have signup the JSreport online and created a simple XLSX template and same has been downloaded using API from ReactJS web application. it is working without any issues.
if i create the same XLSX template in our local JSreport which was hosted in AWS (installed using Docker) and if i download using API from ReactJS web application. it is corrupting the xlsx, but if i directly download the same from the Portal it is not corrupted.
Please let us how do we fix this.
-
We are facing the same issue. If I execute jsreport.renderAsync directly from client side the Excel files are downloaded correctly. But if I use node.js server (with Docker) to download the file is corrupted. I still can't provide more infomation, because the colleague that is developing the node.js API has one more day off. The pdf files are working fine. When he is back, if it is not error on his side we will provide corrupted file. But I assume that it won't be, having in mind that we are not the first one facing the problem.
Best regards,
Teodora
-
Unable to replicate it. Please try to follow my steps so we can isolate the issue.
- Running jsreport docker image
docker run -p 5488:5488 jsreport/jsreport:2.1.1
- Create template
test
with xlsx recipe and content
{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}} <row> <c t="inlineStr"><is><t>Hello world</t></is></c> <c><v>11</v></c> </row> {{/xlsxAdd}} {{{xlsxPrint}}}
- Create client which remotely render report
const client = require('jsreport-client')('http://localhost:5488') const fs = require('fs') async function run() { const report = await client.render({ template: { name: 'test' } }) report.pipe(fs.createWriteStream('out.xlsx')) } run().catch(console.error)
The output file out.xlsx can be open in the ms excel.