Custom Function never sets the value back in the cell

Since moving to an abstract class and new interface implementation, the CustomFunction call is void, requiring the programmer to manually put the calculated value in the cell.
Aspose 17 returned a value which was put in the cell for which it was calculated.

@laurentiu2024,

I guess you are referring to overriding the Calculate method when you create a class derived from AbstractCalculationEngine:

public override void Calculate(CalculationData data)

Yes, the return value is void and does not return anything. Could you please provide the previous definition of the method here? We will evaluate it and then give you details and reasons on why we changed its return type.

Correct.
in ASPOSE 17 it was deriving from ICustomFunction and was defined with a return type of Object

Using ICustomFunction Feature|Documentation (aspose.com)

in ASPOSE 24, no return type anymore and the programmer has to manually set the value.

@laurentiu2024,

You are right. We will soon get back to you with details and clarifications on newer AbstractCalculationEngine model.

@laurentiu2024
When you using the new api AbstractCalculationEngine to calculate custom functions, you should set the calculated result to CalculationData when you implementing the method abstract Calculate(CalculationData).

Please do not change any part of any cell directly when implementing your custom engine, otherwise unexpected result or exception may be caused.

For your reference, this document (Implement Custom Calculation Engine to extend the Default Calculation Engine of Aspose.Cells|Documentation) provides an example to show the implementation of the new api.

Setting data.CalculatedValue= ; seems to have resolved the issue.

@laurentiu2024
Thank you for your feedback. I’m glad your issue has been solved by setting data.CalculatedValue. If you have any questions, please feel free to contact us.