System.NullReferenceException

Hi,

the load of the attached file generates a System.NullReferenceException.



LoadOptions loadOptions2 = new LoadOptions(LoadFormat.Xlsx);

Workbook workbook = new Workbook(“d:\temp\test.xls”, loadOptions2);



thanks in advance for your help.

Hi,


Thanks for your posting and using Aspose.Cells.

We are afraid, your file has a very old format which is not supported. Please see this screenshot and also see this document for more help.


Besides, we are afraid, your code is not correct. If you know the file format, please use

Workbook workbook = new Workbook(path + “test.xls”),

If you want to set the file format, please use the following code:

LoadOptions loadOptions2 = new LoadOptions(LoadFormat.Excel97To2003);
Workbook workbook = new Workbook(path + “test.xls”, loadOptions2);

If the file format is set in the LoadOptions, we do not check the file format again when loading the file. Thank you and have a good day.

You are right.
Thank you for the remark.