jsreport / jsreport-xlsx

jsreport recipe rendering excels directly from open xml
https://jsreport.net/learn/xlsx
MIT License
8 stars 8 forks source link

Error opening xlsx file generated by jsreport. #42

Open thiagogualberto opened 4 years ago

thiagogualberto commented 4 years ago

Guys, good morning !! I'm using jsreport. I have an xlsx template with a header and I use jsreport to insert rows in the spreadsheet. This process inserts content below the header of my template. In addition, I modify 2 header cells with information from my customer's data. I generate the file with this information and save it on my computer. However, opening the file shows the following error: "We encountered a problem with content in 'plan-de-acao_rti.xlsx. Do you want us to try to recover as much as possible? If you trust the source of this workbook, click Yes. "

Could anyone tell me what could be causing this?

pofider commented 4 years ago

You are producing an underlying xml that excel doesn't like because you are breaking some of its rules. It's hard to say which one.

I see two approaches:

  1. Store the excel file as 'corrupted.xlsx'. Then copy it to the 'fixed.xlsx'. Open the 'fixed.xlsx' in the excel app and let it fix. Save it. Rename both to zip files, decompress and compare the content.

  2. Start from scratch by creating tiny few cells excel in the desktop app. Then rename it to zip and explore its content. Then try to replicate the same using xlsx recipe helpers. Iterate and add complexity until you reach the desired result.

thiagogualberto commented 4 years ago

Thank You! @pofider