-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Column Widths Using SetColWidth and GetColWidth #260
Comments
I have also encountered this problem. But I'm getting different results on different devices...
@xuri I don't understand what you said in #1223. Why even set the width will be affected by the monitor resolution. So how do we get consistent operation in all environments. Or is it that the data is in fact certain and set correctly by Excelize, the problem is that Microsoft Office Excel itself for the display of this data. |
We can't get a consistent unit in all environments, which same as the Excel app. The columns width and row height depend on display device resolution, as said in ECMA-376, ISO/IEC 29500 §18.3.1.13:
|
按着这个公式计算后,还是不行 |
Description
When using SetColWidth, I have found that the actual column width seen when opening the file in Excel is 0.71 or 0.72 narrower than the width requested.
Conversely, I have found that GetColWidth reports the colum to be 0.71 or 0.72 wider than it really is.
I have heard it mentioned that this difference will vary depending on the user's printer selection but I have now tried this with at least 4 different printers and the results are exactly the same, regardless which printer I have selected.
Steps to reproduce the issue:
Describe the results you received:
In step 4, the width of column A in Excel was 0.71 or 0.72 narrower than the requested width.
In step 7, the width returned for column A was 0.71 or 0.72 wider than the actual width.
Describe the results you expected:
I expected the column width I set in step 4 to match the the value I set using excelize.
I expected the column width returned in step 7 to match the actual column width.
Upon inspection of the unzipped workbooks at all stages, I have found that Excel stores the column width at a size 0.71 or 0.72 wider than the actual column width desired. I have also found that if View Gridlines is turned off, that difference changes to somewhere between 0.57 and 0.62. Again, the printer selected makes no difference.
Output of
go version
:Excelize version or commit ID:
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
The text was updated successfully, but these errors were encountered: