We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Calculate Formula --> java.lang.ArrayIndexOutOfBoundsException

Hello Aspose team,

I have been using Aspose Java for a while & of late I have been getting a lot of errors like

"
java.lang.ArrayIndexOutOfBoundsException: 9
at com.aspose.cells.Q.e(Unknown Source)
at com.aspose.cells.dB.t(Unknown Source)
at com.aspose.cells.dB.a(Unknown Source)
at com.aspose.cells.bI.b(Unknown Source)
at com.aspose.cells.bI.a(Unknown Source)
at com.aspose.cells.bI.b(Unknown Source)
at com.aspose.cells.bI.a(Unknown Source)
at com.aspose.cells.Cell.c(Unknown Source)
at com.aspose.cells.Worksheet.a(Unknown Source)
at com.aspose.cells.Workbook.calculateFormula(Unknown Source)
at com.aspose.cells.Workbook.calculateFormula(Unknown Source)
at TestExcel.main(TestExcel.java:71)"

Below is my sample code

Workbook workbook = new Workbook();
workbook.open("c:\\temp\\InputFile.xls");
Worksheet inputWorksheet = workbook.getWorksheets().getSheet(0);
System.out.println("ip file open");
Workbook dest = new Workbook();
dest.open("C:\\temp\\TemplateFile.xls",FileFormatType.DEFAULT);
Worksheet destWorksheet = dest.getWorksheets().getSheet(0);
destWorksheet.copy(inputWorksheet);
dest.calculateFormula(); // Fails here
dest.getWorksheets().setActiveSheet(1);
dest.save("C:\\temp\\dest.csv", FileFormatType.CSV);

I have attached the sample test & template file. Please advice.

Thanks

Hello Aspose Team,

I did some investigation & found that it was working before & I have started getting error after I put the fix provided in this forum " https://forum.aspose.com/t/94706 ". When I reverted to old version it works..the new version has issues. Can we fix this to have old functionality working & unmerge option provided as well?

Hi,

Thanks for your sample code and template files. Please try this fix.

@rohitob,

We recommend you to upgrade to latest Aspose.Cells version as Aspose.Cells now provides robust formula calculation engine. It makes it quite easier to perform complex calculations on the data effectively and efficiently. Aspose.Cells’ Formula Calculation Engine allows you to set, read and calculate the results of the following formulas and functions. You can either download or install the API here. See the documents in the section on managing formulas in the spreadsheets.

See the ready to use examples for your reference.