tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

Excel export: Error message when opening a excel file if a grid is exported multiple times to excel. #983

Closed SKPFCW closed 3 years ago

SKPFCW commented 3 years ago

When I export a grid to excel, I can only open the excel file the first time without an error message. If I export it again afterwards, I get an error message when opening the file with Excel:

Environment jqGrid 5.5.4 / WIN10 / Edge Chromium 90 / Chrome 89 / MS Office Pro+ 2016

Using your demo: http://guriddo.net/demo/guriddojs/export/customexcel/

Click "Export to Excel" Wait for the download to finish Open the downloaded file with excel -> no Problem Close excel application.

Click "Export to Excel" again Wait for the second download to finish Open the newly downloaded file with excel -> Error message occurs:

We have identified a problem with some of the content in "jqGridExport (2) .xlsx". Should we restore as much as possible? If you trust the source of this workbook, click "Yes".

After reloading the page, opening the downloaded excel file works again the on the first time.

SKPFCW commented 3 years ago

Update: I unzipped and compared the excel files (the one that opens (=correctFile.xlsx) and one that generates an error message when opening (=failedFile.xlsx)).

failedFile.xlsx correctFile.xlsx

There are differences in the inner file xl\styles.xml. These are the differences:

File xl\styles.xml

Paragraph numFmts:

correctFile: <numFmts count="8">
failedFile: <numFmts count="7">

correctFile: <numFmt numFmtId="171" formatCode="[$$-45C]* ###0.00_-;[$$-45C]* (###0.00_-)"/>
failedFile: =missing line

Paragraph cellXfs:

correctFile: <cellXfs count="68">
failedFile: <cellXfs count="67">

correctFile: <xf numFmtId="171" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/>
failedFile: =missing line

Hope this helps.

tonytomov commented 3 years ago

Hello,

Thank you very much. Your investigations helped a lot. We have fixed the problem. Please let us know if the issues is fixed for you.

Thank you.

SKPFCW commented 3 years ago

Our first tests did not show any problems anymore. Thank you for the quick and competent help. I am closing this issue.