I Use Spreadsheetgear to generate an Excel Workbook.
My Workbook is very simple:
- I insert Strings in cells
- The first line is Bold
- I draw borders around the headers and between the columns.
At the end of the process, i call myRange.Columns.AutoFit(), then I save the workbook.
When I open it with Excel, the autofit is almost good, but it still miss around 1.2 width units in each columns.
Is this a bug in AutoFit() implementation or am I missing something ?
I actually asked SpreadsheetGear support about this as I was building my implementation about 6 months ago. I mentioned that b/c their AutoFit() was not fitting exactly right, that I was having to add a “fudge factor” to each column after autosizing.
Support’s response was essentially that it was a known discrepancy with Excel, that they dont classify as a bug. Here’s what they had to say to me:
And here’s the “fudge factor” that I used to widen the columns as needed:
In C#