Calculate formula after re-setting formula in a cell using Aspose.Cells for .NET in C#

Hi,

I’m using Aspose.Cells 4.7.1.22. You find my testfile attached.

In cell A2 there is a formula"=(“Tabelle1!B”&ROW()-1)“
In my testfile I just reSet this formula to the same cell and try to calculate, but the string value isn’t correct.

please can you check this:

Cell c = workbook.Worksheets[0].Cells[“A2”];
// #1

// Get string value. OK

string value = c.StringValue;

// Re-Set Formula

c.Formula = c.Formula;

// Calc

workbook.CalculateFormula();

// StringValue = #Value!

string value2 = c.StringValue;

// #2

// ReSet Formula again

c.Formula = c.Formula;

// Calc again

workbook.CalculateFormula();

// StringValue= 8

string value3 = c.StringValue;

I have no problem with this formula without the “-1” at the end.
”=(“Tabelle1!B”&ROW())" works

By the way… is there any chance to calculate just one formula, not the hole workbook? something like

workbook.worksheets[0].Cells[“A1”].CalculateFormula();

I’m not sure if it is possible?

Thank you

Hi,

Thanks for providing us template file with sample code.

We have found the issue as you have mentioned. We will fix it soon.

"By the way.. is there any chance to calculate just one formula, not the hole workbook? something like ....workbook.worksheets[0].Cells["A1"].CalculateFormula();"

We will check the feasibility of your demand and let you know soon.

Thank you.


Hi,

Please try the attached version, we have fixed it.

Thank you.

Fine, it works!

Thank you!

The issues you have found earlier (filed as CELLSNET-10036) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Note: Just for your knowledge. In the new release v4.8.0, we have merged Aspose.Grid suite to Aspose.Cells for .NET msi installer as Aspose.Grid would be no longer offered as a separate product now. You need to install the installer (uninstall older one first if you have) and use only Aspose.Cells.dll library in your project for your need. You may also take advantage using Aspose.Cells Grid suite though.