We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Null Reference Errror when initialize blank workbook


We have an application running in production using Aspose.cells to generate plain text data report. It has been working well for a few months. Recently our server encounted quite a number of Null reference exceptions intermittently . The exception trace all point to the same part of Aspose code, as show below:

at Aspose.Cells.x220f433da4115056.x7d0214bf69711dd9(Stream xcf18e5243f8d5fd3)
at Aspose.Cells.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4)
at *****************************.InitBlankWorkbook(String sheetName)
at *****************************************************

Below is our code to initialize the workbook:

private Workbook InitBlankWorkbook(string sheetName)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


License license = new License();


Workbook workbook = new Workbook();

int sheetCount = workbook.Worksheets.Count;

for (int i = sheetCount; i > 0; i--)


workbook.Worksheets.RemoveAt(i - 1);



workbook.Worksheets[0].Name = sheetName;

return workbook;


The code runs on a Windows 64-bit server. The Aspose dll version is:

Please help to investigate. Thank you!


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, I tested your scenario with the attached latest version of Aspose.Cells and did not find any issue. You may check if you are using the correct version for 64 bit machine (please use the dll in NET2.0 folder of your installation path). Please try the attached latest version of Aspose.Cells. If you still face any problem, please create a sample console application to reproduce the issue and post it here. We will check it soon.

Thank You & Best Regards,