We are currently experiencing an issue when trying to calculate formula in Aspose.Cells for Java (24.3), where we would get a CellsException like below:
java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4(Based on cell Calc!B2)
code that’s being used:
final File filepath = "<PATH>/invalid-formula-small.xlsx"; final Workbook workbook = new Workbook(filepath.getAbsolutePath()); workbook.calculateFormula();
formula’s in Excel (attached):
- B1 = WORKDAY(C1,D1, Dates!$A$2:$G$5)
- B2 = WORKDAY(C2,D2,Dates!$A$2:$G$5)
Note: in Excel those formulas seems to be calculated correctly.
Note: issue appears when 2 of similar formulas are present, if it would be just 1 - it would work ok.
Note: issue to be related to reference of Dates!$A$2:$G$5 - which is a list of array of dates
Attachment - Excel file:
invalid-formula-small.xlsx.zip (8.4 KB)
@dmitryfAtVena,
Thanks for the template Excel file.
After an initial test, I was able to reproduce the issue as you mentioned by using your template XLSX file and sample code snippet. I found the issue/exception with calculating WORKDAY formula as you demonstrated.
We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSJAVA-45953
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@dmitryfAtVena,
This is to inform you that your issue (logged earlier as “CELLSJAVA-45953”) has been resolved. The fix will be included in an upcoming release (Aspose.Cells v24.5) that we plan to release in the first half of May 2024. You will be notified when the next version is published.
The issues you have found earlier (filed as CELLSJAVA-45953) have been fixed in Aspose.Cells for Java 24.5.