I create simple test:
[Test]
public void WidthExportTest()
{
var workbook = new HSSFWorkbook();
var sheet = workbook.CreateSheet("Test");
sheet.SetColumnWidth(0, 54);
var row = sheet.CreateRow(0);
var cell = row.CreateCell(0);
cell.SetCellValue( "TestString");
using (var stream = new FileStream(@"c:\temp\export.xls", FileMode.Create, FileAccess.Write))
{
workbook.Write(stream);
}
}
When I open c:\temp\export.xls with the Microsoft Excel the first column is hidden (width is 0). How to set column width correctly?