Problem with the autofit rows and autofit columns

Now I can get autofitrows and autofitcolumns to work when i use it for Aspose.Excel but the problem is that they don’t fully work like they would in Excel. In other words when I use autofitrows and autofitcolumns they do work a little but still leave a quite a bit of space and i was wondering if there was anyway I could make it tighter? The reason I ask is that when I open it in Excel and I can autofit the columns and rows even more then what they currently are.

Here is my code:
while(row >= 0)
{
oWorksheet.AutoFitRow(row);
row–;
}
while(cell < columns)
{
oWorksheet.AutoFitColumn(cell);

cell++;
}

And I run this code after the sheet has already been populated if that makes any difference.

Peter Lim

Hi Peter,

MS Excel use GDI to calculate font width and height while Aspose.Excel use GDI+. So that makes the difference. I had though of using GDI at first but it slowed down the performance heavily.