[Apose.Cells C++] SaveAs in XLS format crashes when Excel file contains invalid "Defined Names"

Hello,
Using Aspose.Cells for C++ 24.2.0
A pointer exception occurs when saving an Excel file to XLS format (Aspose::Cells::SaveFormat::Excel97To2003) when the Excel file contains Defined Names with an invalid expression (Refers To).
In Excel : Formulas / Name Manager.
For example, if the open file is an XLSX file where xl/workbook.xml contains a defined name like <definedName name="xxx">{#N/A,#N/A,FALSE,"EXCISE"}</definedName>

Test steps :

  • Open the XLSX input file (containing a Defined Name with invalid RefersTo expression)
  • Try to Save in Aspose::Cells::SaveFormat::Excel97To2003 format

sample_invalid_defined_name.zip (6.3 KB)

There is no way to catch the error as it is not an exception but a pointer issue (crash).
Note that removing Defined names that start with “={” allows us to work around the crash.
The sample is inspired by a real-life use case where the client XLSX file contains invalid defined names.

@chabodfmoodys,

Thanks for the template Excel file.

We will soon evaluate your issue and get back to you.

@chabodfmoodys
This problem does exist in v24.2. No problem was found when testing with the latest version 25.1. Please try version 25.1. Thank you.

Workbook wb("aaa.xlsx");
wb.Save("output.xls", Aspose::Cells::SaveFormat::Excel97To2003);

Hello Nick,
We have not yet been able to upgrade and test with version 25.1.
Thank you for your reply.

@chabodfmoodys,

We recommend upgrading to newer version (e.g., 25.1) of the API as it includes some enhancements and fixes. Please take your time and try the latest version, i.e., Aspose.Cells for C++ v25.3 (if possible). Let us know your feedback once you try the newer version of the API.

Hello,
We tried upgrading to v25.3 and it seems to solve the issue.
Thank you for your support.

@chabodfmoodys
You are welcome!
Thank you for confirming. We’re glad to hear your issue has been resolved.