tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.46k stars 407 forks source link

Libreoffice Calc can't open a file saved by xlnt #312

Open yannou38 opened 6 years ago

yannou38 commented 6 years ago

Hello,

When xlnt open and edit one of my excel files, it add a lot of (empty) xml nodes in my sheet, which bump the file size up and make it unopenable on my ( very old) machine.

my base file only have about 10 col nodes, and after saving xlnt bumped it to 1025 col nodes. Interesting enough is that every col have a width value (don't remember the exact property name) different from the base one. this may have to do.

xlnt can reopen the file without problem.

I'm on a very old debian.

sukoi26 commented 6 years ago

LibreOffice allows 1024 columns maximun. i test a file with > limit and it warms. Your case only 10 columns , i suspect an excess of style as custom widths to columns >1024, check the sheet.xml of your workbook as below

<worksheet><dimension ref="A1:F71"/><sheetFormatPr/><cols><col min="1" max="1" width="14.7142857142857" customWidth="1"/><col min="2" max="2" width="19.2142857142857" customWidth="1"/><col min="3" max="3" width="90.7142857142857" customWidth="1"/></cols><sheetData>

in tag <cols> </cols> how many items ?

sukoi26 commented 6 years ago

i investigate more, i find something strange , first i read an original EXCEL file, the sheet.xml below
attention the dimension is A1:AMJ317 but the cols are only 11, when i read the file with LIBREOFFICE no warning

<worksheet><sheetPr filterMode="false"><tabColor rgb="FF9DC3E6"/><pageSetUpPr fitToPage="false"/></sheetPr><dimension ref="A1:AMJ317"/><sheetViews><sheetView showFormulas="false" showGridLines="false" showRowColHeaders="true" showZeros="true" rightToLeft="false" tabSelected="true" showOutlineSymbols="true" defaultGridColor="true" view="normal" topLeftCell="A1" colorId="64" zoomScale="70" zoomScaleNormal="70" zoomScalePageLayoutView="100" workbookViewId="0"><pane xSplit="3" ySplit="13" topLeftCell="D17" activePane="bottomRight" state="frozen"/><selection pane="topLeft" activeCell="A1" activeCellId="0" sqref="A1"/><selection pane="topRight" activeCell="D1" activeCellId="0" sqref="D1"/><selection pane="bottomLeft" activeCell="A17" activeCellId="0" sqref="A17"/><selection pane="bottomRight" activeCell="P17" activeCellId="0" sqref="P17"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15" zeroHeight="false" outlineLevelRow="0" outlineLevelCol="0"/><cols><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="1" min="1" style="1" width="31"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="2" min="2" style="2" width="19"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="3" min="3" style="3" width="19"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="4" min="4" style="4" width="47.33"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="8" min="5" style="3" width="18"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="12" min="9" style="3" width="14.17"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="13" min="13" style="1" width="77.66"/><col collapsed="false" customWidth="true" hidden="true" outlineLevel="0" max="14" min="14" style="5" width="13.66"/><col collapsed="false" customWidth="true" hidden="true" outlineLevel="0" max="15" min="15" style="5" width="13.5"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="811" min="16" style="1" width="11"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="1025" min="812" style="0" width="10.31"/></cols>

i save the file with an XLNT app , the file sheet.xml become, no change in dimension but the cols goes to 1025 col , so explain the warning of LIBREOFFICE. the question is : Why xlnt create the number of col between the reader and producer ?

i test the xlnt app with a new sheet creation no concern


<worksheet><sheetPr filterMode="false"><outlinePr summaryBelow="1" summaryRight="1"/><pageSetUpPr fitToPage="0"/></sheetPr><dimension ref="A1:AMJ317"/><sheetViews><sheetView tabSelected="1" topLeftCell="A1" workbookViewId="0"><pane topLeftCell="D17" xSplit="3" ySplit="13" activePane="bottomRight" state="frozen"/><selection activeCell="A1" sqref="A1"/><selection activeCell="D1" sqref="D1"/><selection activeCell="A17" sqref="A17"/><selection activeCell="P17" sqref="P17"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/><cols><col min="1" max="1" width="31" style="1" customWidth="1"/><col min="2" max="2" width="19" style="2" customWidth="1"/><col min="3" max="3" width="19" style="3" customWidth="1"/><col min="4" max="4" width="47.33" style="4" customWidth="1"/><col min="5" max="5" width="18" style="3" customWidth="1"/><col min="6" max="6" width="18" style="3" customWidth="1"/><col min="7" max="7" width="18" style="3" customWidth="1"/><col min="8" max="8" width="18" style="3" customWidth="1"/><col min="9" max="9" width="14.17" style="3" customWidth="1"/><col min="10" max="10" width="14.17" style="3" customWidth="1"/><col min="11" max="11" width="14.17" style="3" customWidth="1"/><col min="12" max="12" width="14.17" style="3" customWidth="1"/><col min="13" max="13" width="77.66" style="1" customWidth="1"/><col min="14" max="14" width="13.66" style="5" hidden="1" customWidth="1"/><col min="15" max="15" width="13.5" style="5" hidden="1" customWidth="1"/><col min="16" max="16" width="11" style="1" customWidth="1"/><col min="17" max="17" width="11" style="1" customWidth="1"/><col min="18" max="18" width="11" style="1" customWidth="1"/><col min="19" max="19" width="11" style="1" customWidth="1"/><col min="20" max="20" width="11" style="1" customWidth="1"/>

....

<col min="1020" max="1020" width="10.31" style="0" customWidth="1"/><col min="1021" max="1021" width="10.31" style="0" customWidth="1"/><col min="1022" max="1022" width="10.31" style="0" customWidth="1"/><col min="1023" max="1023" width="10.31" style="0" customWidth="1"/><col min="1024" max="1024" width="10.31" style="0" customWidth="1"/><col min="1025" max="1025" width="10.31" style="0" customWidth="1"/></cols>
sukoi26 commented 6 years ago

i forget the LIBREOFFICE app Version: 6.0.5.2 Build ID: 1:6.0.5-1 on Linux 4.17 DEBIAN

sukoi26 commented 6 years ago

important in original file : the max min value ? <col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="811" min="16" style="1" width="11"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="1025" min="812" style="0" width="10.31"/>

sukoi26 commented 6 years ago

important in original file : the max min value ? <col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="811" min="16" style="1" width="11"/><col collapsed="false" customWidth="true" hidden="false" outlineLevel="0" max="1025" min="812" style="0" width="10.31"/>

sukoi26 commented 6 years ago

i test LIBREOFFICE with <col min="1025" max="1025" width="11" style="1" customWidth="1"/> with 1024 no concern , so it is a bug of LIBREOFFICE it cannot detect the max = "1025" min="812" but only case max="1025" min="1025"