Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Autosize of column-width seems to work invalid #125
Regarding the 30% undercut in autowidth, can you start by posting a copy of your code?
To specify the column widths (which, by the way is what we do at my day job because of post render formats that axlsx cannot calculate) have a look here:
I usually use frames on rubydoc:
Hi, I'm facing the same issue. I use
sheet.column_widths nil, 2, nil, nil, nil
I've tried using it just at the beginning of populating the sheet and at the very end of the sheet population.
Also what is the unit, so what does 2 mean in my example above?
I'm on Snow Leopard using MS Excel 2011, version 14.3.1
RE: the unit of measurement - from the ECMA docs:
Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.
[Example: Using the Calibri font as an example, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi). In fact, each digit is the same width for this font. Therefore, if the cell width is 8 characters wide, the value of this attribute must be Truncate([8_7+5]/7_256)/256 = 8.7109375. end example]
You can see how this is applied in Cell#autowidth.
I have to confess I am not 100% satisfied with this as different fonts and font sizes can have different maximum diget width.
No worries. I was simply explaining what the 'unit' is for these widths.
I'd like to experiment a bit and see if I can improve it.