Hi,
Thanks for the screenshot.
Well, we did change the custom formula calculations in recent versions. If one parameter for the custom function is cell reference, in old version Aspose.Cells APIs used to convert the cell reference to one cell value or an object array of all cell values in the referred area. Since v8.5.0, the API just puts the ReferredArea object into the “paramsList” when the corresponding parameter is a reference or its calculated result is reference. If you need the reference itself then you can use the ReferredArea directly. If you need to get one single cell value from the reference corresponding with the formula’s position, you can use ReferredArea.GetValue(rowOffset, int colOffset) method. If you need cell values array for the whole area, then you can use ReferredArea.GetValues method. Please see the document for your complete reference:
I have also changed the code segments in accordance with latest APIs change, please refer to it and update your code segment accordingly:
e.g
Sample code:
…
object firstParamB1 = paramsList[0];
if (firstParamB1 is ReferredArea) //fetch data from reference
{
ReferredArea ra = (ReferredArea)firstParamB1;
if (ra.IsArea)
{
firstParamB1 = ra.GetValues();
}
else
{
firstParamB1 = ra.GetValue(0, 0);
}
}
//get value of second parameter
object secondParamC1C5 = paramsList[1];
decimal total = 0M;
if (secondParamC1C5 is ReferredArea) //fetch data from reference
{
ReferredArea ra = (ReferredArea)secondParamC1C5;
if (ra.IsArea)
{
secondParamC1C5 = ra.GetValues();
}
else
{
secondParamC1C5 = ra.GetValue(0, 0);
}
}
if (secondParamC1C5 is Array)
{
// your code goes here.
}
…
Also, we will soon update the document/articles in the Docs to accommodate the new change.
Thank you.