Invalid formula:

We are using an older version of Aspose (which we cannot change for the time being due to various reasons). The version is 4.5.1.0. While saving an xls file we get an exception saying:

Invalid formula:
Stacktrace is:
Source: Aspose.Cells Invalid formula: Stack Trace:
at Aspose.Cells.Cell.?(Byte[]& ?, Int32& ?, Int32 ?, ? ?)
at Aspose.Cells.Cells.?(? ?, FileFormatType ?)
at Aspose.Cells.Worksheet.?(? ?)
at Aspose.Cells.Worksheets.?(? ?)
at Aspose.Cells.Worksheets.?(FileFormatType ?)
at Aspose.Cells.Worksheets.?(Stream ?, FileFormatType ?)
at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)
at Aspose.Cells.Workbook.Save(String fileName, FileFormatType fileFormatType)
at xxx.yyy(MyObject myObj)


My question is: is there a way to tell which tab in the xls file caused the error, so we can narrow down. If not, I would strongly recommend that you should add it. It will make debugging much easier.

thanks,

Hi,

Thank you for considering Aspose.

Well, as you are using an old version of Aspose.Cells, we think that the issue is not with some formula but is regarding to SystemOutOfMemory. For this issue, we have changed the error messages in our latest version but in old versions it may show some different message (as invalid formula in your case) Please check the size of the file you are using. I have also attached the latest version so you may test if the issue occurs with the latest version or not.

Thank You & Best Regards,

Thanks for the updated DLL… but as I mentioned, we cannot replace the older assembly because we have some legacy code that uses it (and is extremely fragile). In any case,

we found the issue. The excel file had a huge amount of (100s) invalid references. Once
we removed all the #REF! errors, the file saved nicely.

My suggestion to include the tab name whenever there is a problem or exception is actually just a recommendation on how the product can be made better. That’s all.

thanks,

Hi,

Thanks for your suggestion, we have already enhanced the exception strings in our later versions of the component.

Have a good day!

Actually, I had a realted question. What if we want to delete the invalid references (denoted by #REF!), programmatically? How do we do that in code? Assume this is for xls files.


thanks,

hello … any answer on this?

Hi,

Well, I am afraid, you have to delete those formulas (#REF!) by yourself manually as we don't provide such public api to detect those #REF! formulas in the spreadsheets.

Thank you.

Is this something, that you plan to add? It would be a very nice-to-have feature… as it can help us automate some of our workflow…