Using Axlsx some of my cells are set to wrap text which works great. The problem I'm running into is how the auto-width of the cells seems to be calculated. It seems like what's happening is initially the data comes in like this:
cell line1 cell line2 cell line3 cell line4 cell line5
Which Axlsx using to set the width to be that big. But then wrap text comes in and correctly sets the cell to this:
cell line1
cell line2
cell line3
cell line4
cell line5
It's height is then set correctly to display all five values but the row width is still huge. Does anyone know if there's a way to get Axlsx to auto-size the cell as if you were to double click the cell within Excel to have it auto size the width? Setting Excel column widths correctly when adding to spreadsheet via Axlsx seems to elude to it but I couldn't get it to have any effect - not sure the :widths
property exists anymore or works?
I also have been playing around with column_widths as well e.g. sheet.column_widths *30
. Does anyone know if there's a way to force all columns to have the same widths with this property? It doesn't seem to accept an array - only integers/floats/fixnums separated by commas and doing *30 only sets the first column to a width of 30. I don't actually know beforehand how many columns I'm going to be using (dynamic data) so I'd love to be able to set that to just auto-size all of the columns to a certain width.