Direct Calculation of Custom Function without Writing it in a Worksheet with Golang via C++

Direct Calculation of Custom Function without Writing it in a Worksheet

This topic explains how you can directly calculate your custom functions without first writing them in a worksheet. Please use the Worksheet::CalculateFormula(System::String formula, CalculationOptions opts) method for this purpose.

Please see the following sample code that illustrates the usage of this method. We have used a custom function named MyCompany::CustomFunction() and we calculate its value as “Aspose.Cells." ourselves; then this value is automatically concatenated with the value of cell A1, which is “Welcome to “, by the calculation engine, and the final calculated value is returned as “Welcome to Aspose.Cells." As you can see in the code, we have not written our custom function anywhere in a worksheet, and it is calculated directly by our own custom logic.

Programming Sample

Console Output

Below is the console output of the above sample code.

Calculated Value: Welcome to Aspose.Cells.

Related Article