You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just took a look at the spec, and I'm afraid that this doesn't appear to be possible. That property is described as follows: 'Best fit' means that when numbers are typed into a cell contained in a 'best fit' column, the column width should automatically resize to display the number. If you want the column to fit arbitrary content, I think you'll need to find the number of characters in the longest cell in the column then set the column width to that number. It won't be perfect, but it should be close. Column width is defined as follows in the standard: 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. Someone could probably write a helper method on the xlnt::worksheet that executes that logic, effectively like double-clicking on the divider between columns in Excel.
I can't see any simple way of achieving this, I tried:
worksheet.column_properties(cell.column()).best_fit = true;
But it doesn't work
The text was updated successfully, but these errors were encountered: