When I try to create a new column on table, the method CreateColumn return the following error:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at NPOI.XSSF.UserModel.XSSFTable.CreateColumn(String columnName, Int32 columnIndex)
Codes
private static void CreateCustomSheet(IWorkbook workbook, List<MyCustomClass> values)
{
// Create Sheet
XSSFSheet sheet = (XSSFSheet)workbook.CreateSheet("SheetName");
sheet.TabColor = new XSSFColor(SixLabors.ImageSharp.Color.Orange);
// Create table
XSSFTable table = sheet.CreateTable();
table.Name = "TableName";
table.CreateColumn("ColumnName1", 0); // <-- Here
table.CreateColumn("ColumnName2", 1);
table.CreateColumn("ColumnName3", 2);
table.StyleName = XSSFBuiltinTableStyleEnum.TableStyleLight9.ToString();
// Fill in the data
// [...]
}
2.7.0
Issue Description
When I try to create a new column on table, the method
CreateColumn
return the following error:Codes