Loading XLSM file works in Excel, fails in Aspose Cells with NPE

Hi,

Using Aspose Cells for Java, version 20.6.

The attached XLSM workbook loads in Excel 2010, but throws the following exception when loaded with Aspose Cells:

Exception in thread "main" java.lang.NullPointerException
	at com.aspose.cells.zchv.b(Unknown Source)
	at com.aspose.cells.zchv.a(Unknown Source)
	at com.aspose.cells.VbaProject.e(Unknown Source)
	at com.aspose.cells.ze.w(Unknown Source)
	at com.aspose.cells.ze.a(Unknown Source)
	at com.aspose.cells.zaqk.a(Unknown Source)
	at com.aspose.cells.zjw.a(Unknown Source)
	at com.aspose.cells.zjw.a(Unknown Source)
	at com.aspose.cells.Workbook.a(Unknown Source)
	at com.aspose.cells.Workbook.<init>(Unknown Source)
	at Demo.main(Demo.java:46)

Sample code:

LoadOptions loadOptions = new LoadOptions();
loadOptions.setKeepUnparsedData(false);
loadOptions.setParsingFormulaOnOpen(false);
LoadFilter loadFilter = new LoadFilter(LoadDataFilterOptions.VBA);
loadOptions.setLoadFilter(loadFilter);

Workbook workbook = new Workbook("input.xlsm", loadOptions);
VbaModuleCollection modules = workbook.getVbaProject().getModules();
System.out.println("total modules: " + modules.getCount());

Sample input is attached.

Kind regards,
Taras

input.zip (17.0 KB)

@TarasTielkes,
We have observed that while using loadOptions.setKeepUnparsedData(false) raises this exception and when we set it to true, there is no exception. We have logged this issue in our database for further analysis and will write back here once any update is ready to share.

This issue is logged as:

CELLSJAVA-43229 - Exception while loading XLSM file with option setKeepUnparsedData(false)

Hi @ahsaniqbalsidiqui,

Loading the provided file without KeepUnparsedData option does indeed not throw the exception. However, it does not seem to find the VBA modules present in the workbook. So it seems that there is a secondary issue.

Kind regards,
Taras

@TarasTielkes,
Here this line was causing exception, however as this issue is already being analyzed here, therefore spare us little time to complete the analysis and provide our feedback.

@TarasTielkes,
Please try our latest version/fix: Aspose.Cells for Java v20.6.4:
aspose-cells-20.6.4-java.zip (7.1 MB)

Your issue should be fixed in it.

Let us know your feedback.

Hi @ahsaniqbalsidiqui,

The latest version does indeed fix the problem.

Thank you,
Taras

@TarasTielkes,

Good to know that your issue is sorted out by the new fix. In the event of further queries or issue, feel free to write us back and we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-43229) have been fixed in Aspose.Cells for Java 20.7. This message was posted using Bugs notification tool by Amjad_Sahi