Excel files gets recalculated using AbstractCalculationEngine - Java vs .NET

I am using the AbstractCalculationEngine derived class to provide some custom values for UDF (user defined formulas).
The test implementation is very simple:

  • I open the Excel using Aspose
  • return a hard coded value for every function call.
  • Save the Excel

The issue is following: When I open the saved Excel in Office Excel program, the file gets immediately calculated (which is unwanted behavior).
The immediate calculation happens only in Java implementation (21.3). In .NET (21.3) implementation it works ok.
I tried setting ReCalculateOnOpen to false -> no change.

dot_net.zip (812 Bytes)
hello_java.zip (839 Bytes)

I am attaching the both examples.

Thanks
Eyal

@eyalmolad,

Please zip and attach your template Excel file “check_asposee.xlsx”, we will check it soon.

By the way, could you try the following line instead before saving the file if it makes any difference:
e.g.
Sample code:

// Save to XLSX by setting the calc mode to manual
workbook.getSettings().setCalcMode(CalcModeType.MANUAL);

Yes - this made the difference. But my client can not use the Excel in manual mode.

Attached is the file.check_asposee1.zip (7.2 KB)

@eyalmolad,
We have tried your sample code for .NET and Java without any modification but could not observe any difference as both the Excel files show the cell data. Could you please share some image showing issue in the attached output files? Note that when we open both the Excel files in MS Excel, the calculation mode is set to AUTOMATIC.
HelloWorld_DOTNET_out.xlsx.zip (8.0 KB)
HelloWorld_java_out.xlsx.zip (8.0 KB)

Hi, thanks for the results - I opened both Excels on my machine, no calculations are made (which is good).
I am attaching my results in the file.outputresults.zip (16.6 KB)

Also, attaching a screen shot of Java error.
image.png (12.2 KB)

Screen shot of my Excel version (I dont think it’s related).
image.png (3.0 KB)

@eyalmolad,
This is quite strange as when I open your Java output file here, it shows “#Name?”, therefore it is not dependent on version of MS Excel. Could you please display the Aspose.Cells version number in your Java code and verify that the latest version is being used as using the latest version here, no issue is observed.

System.out.println(com.aspose.cells.CellsHelper.getVersion());

This line returns 21.2.0.

I upgraded to 21.3 and it works!
Thank you.

@eyalmolad,
You are welcome.