Free Support Forum - aspose.com

NullPointerException when open xlsm file

Good morning,
I try to open a xlsm file with Aspose Cells version 18.10 but the system return a “NullPointerException” error. If I use the last version (19.11) of Aspose Cells, the system open properly my file.

This is my code:

package com.tagetik.cpm.ooxml.aspose.cells;

import com.aspose.cells.Workbook;

public class TestOpenExcelFiles {

  public static void main(String[] args) throws Exception {
    Workbook workbook = new Workbook("C:\\temp\\ASPOSE\\SOURCE.xlsm");
    System.out.println(workbook.getFileName());
  }
}

At the moment I can not update the Aspose Cells version.
Could you help me to understand what the problem is, please?
Thanks,
Giulio

SOURCE.zip (1.4 MB)

@giulio.andolfi,

Thanks for the template file and sample code.

Yes, the issue is not there using latest version/fix as I tested using your template file and sample code segment. In short, it is always better to upgrade to latest version/fix as we included more enhancements in reading MS Excel file formats modules in recent versions. I am afraid, it is hard to identify the culprit in the file which might cause the error in older version (Aspose.Cells for Java v18.10). Anyways, we will still try to trace it but we do not promise that we will be successful.

Once we have an update, we will let you know.

Thanks for your time @Amjad_Sahi.
I kwon that the best solution is update the version, but I can not do it before next January.
I hope that you can help me.
Regards,
Giulio

Hi @Amjad_Sahi,
sorry if I insist, but I would like to understand if I can solve the problem even without updating Aspose Cells.
Our customer can not update our system before January.
I would like write them a possible workaround.
Thanks.

@giulio.andolfi,

I am afraid, we could not find any workaround (except to upgrade to latest version/fix) to cope with your issue. In case, we find some workaround or update on it, we will let you know.

Hi @Amjad_Sahi,
thanks for information.
Could you send me the issue number, please?
I would like find it on release notes.
Thanks

@giulio.andolfi,

Well, in recent versions we enhanced modules for reading/loading MS Excel file formats (e.g XLS, XLSX, XLSB, etc.) in Aspose.Cells APIs, so your issue might be fixed automatically. Also, in past releases, we fixed issues regarding the exception “NullPointerException” a few times when loading template files into Aspose.Cells object model but those issues are specific to users’ template files.

@giulio.andolfi,
Some additional information for you, the exception was caused by some formulas in sheet CR_SCEN. You may remove or modify the formulas in following cells to avoid the exception:

Row 728, 1048, 1368, 1688, 2328

Column AW, AX, BC, BD

That is, the formulas of cells AW728, AX728, BC728, BD728, AW1048, …, BD2328 caused the exception. Besides the exception, maybe you want to check more for those formulas to confirm whether it is the expected expression because all of them produce error values.