Cell width problem

Hi Ade,

Try using this method:

private static void SetWidth(ExcelColumn column, double width)
{
    column.SetWidth(
        Math.Truncate((width * 7 + 5) / 7 * 256) / 256,
        LengthUnit.ZeroCharacterWidth);
}

Here is a small sample code that uses it:

var workbook = new ExcelFile();
var worksheet = workbook.Worksheets.Add("Sheet1");

SetWidth(worksheet.Columns["A"], 8);
SetWidth(worksheet.Columns["B"], 9);
SetWidth(worksheet.Columns["C"], 10);
SetWidth(worksheet.Columns["D"], 11);
SetWidth(worksheet.Columns["E"], 16);
SetWidth(worksheet.Columns["E"], 17);

workbook.Save("Output.xlsx");

I hope this helps.

Regards,
Mario