I have a template and after filling it with values I set a background color but for a small file (about 6000 rows) it takes about 4 minutes. Whithout setting background color it takes only 8 seconds.
My code is:
var hssfworkbook = new XSSFWorkbook(file);
var sheet = hssfworkbook.GetSheetAt(0);
for (int i=0; i<sheet.LastRowNum; i++)
{
var currentCellStyle = hssfworkbook.CreateCellStyle();
currentCellStyle.FillForegroundColor = IndexedColors.Green.Index;
currentRow.Cells.ForEach(x=> x.CellStyle = currentCellStyle);
}
My code is:
var hssfworkbook = new XSSFWorkbook(file);
var sheet = hssfworkbook.GetSheetAt(0);
for (int i=0; i<sheet.LastRowNum; i++)
{
var currentCellStyle = hssfworkbook.CreateCellStyle();
currentCellStyle.FillForegroundColor = IndexedColors.Green.Index;
currentRow.Cells.ForEach(x=> x.CellStyle = currentCellStyle);
}