protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
817 stars 417 forks source link

Excel file needs to be repaired after saving #39

Open adamtaylor13 opened 8 years ago

adamtaylor13 commented 8 years ago

I have my project running xlsx-style perfectly except for a couple annoying issues. The biggest and most problematic of these is the fact that whenever I save my workbook and then attempt to open it. I get this problem: image

Which isn't really descriptive.. Upon further investigation I get this: image

image

Note that I can actually read the file and everything in it was written correctly with the correct styles, etc. But for some reason it feels the need to go through this repair business which for the client would be an extreme inconvenience.

Any help with this would be greatly appreciated.

zyuhel commented 7 years ago

Have the same issue. Although it appears that it is available on windows excel 2013, but doesn't appear on Excel 2008 for Mac. For me reproduce it on windows i need to add new cells and migrate merges using !ref and !merges sheet properties. If i touch just one property no repair warning. Resulting file is too large. 15mb before repair and 5mb after. On repair it removed all line breaks. It creates SharedStrings xml and compresses data using dictionary. Excel 2008 for Mac doesn't do this. So i think this is some format issue. Recovered file add some new namespaces. So i think this issue can be hard to find the solution.

zyuhel commented 7 years ago

Small addition. This somehow correlates with /r symbols in the cells.

gdoteof commented 7 years ago

Everytime I have gotten this issue it's been something on my end; in my case the most common is to give a string and try and format it as a number.

It's a huge pain but you can debug this -- if you can't figure it out -- by breaking up the xlsx file (it's just a zip file of mostly xml files) and the diffing the repaired and unrepaired versions that show up in the log file.

If you can show exactly what is breaking and how it will be easier to figure out your problem and get a fix into the repo, if it is indeed a problem of the library.