Posted 15 September 2020, 1:47 am EST
Hi,
You are adding your custom function after loading the XML file. Once the XML file is loaded, all the formulas are parsed. At this point, the “GetEstimation” function is not known (since it’s added later).
Even if the functions are re-evaluated, only the parsed formula is evaluated (and the parsed formula does not know anything about “GetEstimation”).
When the formula for any cell is changed (like you have done by setting the formula again), the formula is parsed again. Since the definition for “GetEstimation” is available at this point, the formula is evaluated correctly.
To avoid this, you need to add the custom function before loading the XML file:
fpSpread1.AddCustomFunction(new GetEstimation());
this.fpSpread1.Sheets.Add(fpSpreadToOpenFile.Sheets[0]);
Also, note that the new AddCustomFunction on FpSpread takes an object of GrapeCity.CalcEngine.Function.
Regards,
Jitender