Originally created by: teschste
Description
I have found that if you open a workbook that was previously saved with excelize but has not yet been opened and re-saved with Excel, and then call GetColWidth on any column, it will report the column width as 64, no matter what the actual column width is.
Steps to reproduce the issue:
1. Create an excelize file.
2. Create a worksheet.
3. Use SetColWidth to set column A to a specific width.
4. Save the file.
5. Open the workbook with excelize.
6. Check the width of column A; the reported width will be 64.
7. Check the width of column B (an undefined column); the reported width will be 64.
8. Unzip the workbook.
9. Edit the customWidth property of the col property for column A, setting it to "1" instead of "true".
10. Rezip the workbook.
11. Open the workbook with excelize.
12. Check the width of column A; the reported width will now be correct.
13. Check the width of column B (an undefined column); the reported width will still be 64.
Describe the results you received:
After comparing the unzipped version of a sheet created by excelize, both before and after re-saving the same workbook with Excel, I have found two problems:
For a column that had no been specifically adressed during the file creating process, there is no col property to read, so some process is defaulting the width to 64, which is not the default column width in Excel.
When excelize saves the column properties (say after calling SetColwidth), it sets the customWidth property to "true" but when Excel saves the same value, it sets it to "1".
For the second problem above, I have found that if I take a workbook that was created by excelize, unzip it, edit the column's customWidth property so it is set to "1" instead of "true", then zip the workbook up again, the problem is resolved andGetColWidth now reports the correct column width.
Describe the results you expected:
I expected the correct default value returned by GetColWidth for undefined columns.
I expected excelize to store properties in the same way that Excel does (i.e. customWidth property on defined columns set to "1" instead of "true).
Output of go version
:
go1.10 windows/amd64
Excelize version or commit ID:
ec37b114c3b704a84c66fcf3e135c9df88ffb24d
Environment details (OS, Microsoft Excel™ version, physical, etc.):
Windows 7 Professional SP1 64-bit, Core i5-2400 @ 3.10GHz, with 8GB RAM
Excel 2007 12.0.6787.5000 SP3 MSO
Originally posted by: piaoger
@teschste I met this issue and borrown a solution from sheetjs :) I called px2width before setting col width