Set column width when not using standard font

Nov 18, 2010 at 3:04 AM

Hi all,

I'm creating Excel files using a template file with a fixed font type and size for all the cells (for example: Trebuchet MS, 9).

If I set the width of a column to 10 by using the default conversion factor:

int colWidth = 10 * 256;

sheet.SetColumnWidth(col_index, colWidth);

When I open the Excel file and check the column width, I see that it was set to 9.29 instead of 10.

Could you please tell me how to get the right value of the colWidth variable when cells aren't formatted with the standard font?

Thanks in advance!