This project is read-only.

AutoSizeColumn does not work in V 1.2.1.0

Dec 21, 2009 at 9:02 PM

Hello,

I did the following to set auto size on column. It still does not format properly. The columns do not autofit...do I need to do something else?

for (int i = 0; i <= 120; i++)
{
                sheet.AutoSizeColumn(i);

}

Dec 21, 2009 at 10:05 PM

This is a known bug http://npoi.codeplex.com/WorkItem/View.aspx?WorkItemId=3754. It has been already fixed in NPOI 1.2.2. Please download the latest version. Thank you for your feedback!

May 28, 2010 at 4:33 PM

Works a treat in 1.2.2, thanks Tony!

      // autosize each column
      // NOTE: this must be done *after* the worksheet has been populated!
      IEnumerator columns = row.GetCellEnumerator();
      while (columns.MoveNext())
      {
        HSSFCell column = (HSSFCell)columns.Current;
        ws.AutoSizeColumn(column.ColumnIndex);
      }