Apr 5, 2013 at 5:48 PM
Edited Apr 8, 2013 at 8:15 AM
We use NPOI HSSF to make an Excel of 50K rows in 9 seconds.
But when changed to use the XSSF (IWorkbook interface), the time needed increase until 3 minutes.
Our code for both tests is the same, we only change the constructor and some type definition.
Also, it is remarkable that, the performance gets worst in time.
For 30k, it takes 25 seconds.
For 70k, it takes 4 minutes.
For 300k, it takes 80 minutes!!!!
We need to use XSSF to support more than 65K rows.
Is there any problem with the performance for XSSF?
Why is the performance degrading when more rows are created?
We have use a NPOI example to see this.
Just change the new XSSFWorkbook() to new HSSFWorkbook(), and you can see that the HSSF takes 1 second, and the XSSF takes 1 minute!!!
static void Main(string args)
IWorkbook workbook = new XSSFWorkbook();
ISheet sheet1 = workbook.CreateSheet("Sheet1");
sheet1.CreateRow(0).CreateCell(0).SetCellValue("This is a Sample");
int x = 1;
Debug.WriteLine("Start at " + DateTime.Now.ToString());
for (int i = 1; i <= 30000; i++)
IRow row = sheet1.CreateRow(i);
for (int j = 0; j < 15; j++)
Debug.WriteLine("End at " + DateTime.Now.ToString());
FileStream sw = File.Create("test.xls");
Thanks in advance!