Good evening, we’ve encountered a problem with a file excel generated and saved using Aspose.Cells .NET
Hi,
Thanks for the template file and details.
After an initial test, I observed the issue as you mentioned by using the following sample code with your template file. I found an issue with Workbook.CalculateFormula() method, it does not calculate the formulas correctly:
e.g
Sample code:
Workbook workbook = new Workbook(“e:\test2\Rep+EsempioErroreAspose.xlsm”);
workbook.CalculateFormula();
Console.WriteLine(workbook.Worksheets[“C.SCR_Def_List”].Cells[“AH16”].StringValue);
Console.WriteLine(workbook.Worksheets[“SCR_Def_Calculation”].Cells[“D18”].StringValue);//it should be 16
Console.WriteLine(workbook.Worksheets[“SCR_Def_Calculation”].Cells[“E18”].StringValue);//it should be 104
Output:
0.0100%
2
2
I have logged a ticket with an id “CELLSNET-45087” for your issue. We will look into it soon.
Once we have an update on it, we will let you know here.
Thank you.
Ok we wait for a response. It’s very important for our project to solve this problem. We notice that in a older version 8.2.3 the errors not happened. We’ve changed versione for another bug with formula IRR that we find fixed in version 16.11 and recent.
Hi,
We have evaluated your issue further. Well, you need to specify PrecisionStrategy for calculating formulas via Aspose.Cells APIs. I have tested it and it works fine, see the updated sample code for your reference:
e.g
Sample code:
Workbook workbook = new Workbook("e:\test2\Rep+EsempioErroreAspose.xlsm");
CalculationOptions co = new CalculationOptions();
co.PrecisionStrategy = CalculationPrecisionStrategy.Round;
workbook.CalculateFormula(co);
Console.WriteLine(workbook.Worksheets["C.SCR_Def_List"].Cells["AH16"].StringValue);
Console.WriteLine(workbook.Worksheets["SCR_Def_Calculation"].Cells["D18"].StringValue);//16 - Ok
Console.WriteLine(workbook.Worksheets["SCR_Def_Calculation"].Cells["E18"].StringValue);//104 - Ok
Let us know if you still have any issue.
Thank you.
HI, thank you for the response. We try your suggestion but before we need to know what this change can produce in formula calculation because our software produce a great number of excel files and a change can produce a lot of regression. Can you explain this change what means in evaluating formula? There is the same option in Excel?
Hi,
Hi, thank you for the clarifications.
Hi,
Hi,
Hi,
Thanks for using Aspose.Cells.
For your issue, please try our latest fix given below. Now, you do not need to use the PrecisionStrategy option.
Aspose.Cells for .NET v17.1.8 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.1.8 (.NET 4.0) compiled in .NET Framework 4.0.
Let us know your feedback.