Page tree
Skip to end of metadata
Go to start of metadata

Introduced in build 9.1

Description

The RegisterCustomFunction method registers an IFunction object with the workbook to be used when calculating a specific custom Excel formula.
C#
vb.net

Disabling Excel Calculation

Icon

Registering a formula allows ExcelWriter to calculate a function a certain way. However, once the workbook opens inside of Microsoft Excel, Excel will calculate the formula again with its own calculation engine. This means that if you registered a function name that does not exist in Excel, your formula will evaluate to #NAME? once Excel recalculates it. If you overwrote a formula with you own implementation, the formula will be recalculated using the implementation that is built into Excel. To keep Excel from re-calculating the formulas upon opening the workbook or upon changing values in the workbook, go to File -> Options -> Formulas. Under the "Calculation Options" header, there is an option called "Workbook Calculation". Please select the "Manual" option and uncheck the "Recalculate workbook before saving" checkbox. Now Excel will not re-calculate formulas. These settings will allow you to preserve the values that ExcelWriter calculated.

Parameters

 

customFunctionName
The name of the Excel Function you want to bind your custom IFunction logic to.
customFunction
The custom logic you want to use for a specific Excel formula. You implement this logic by using the IFunction interface

Examples

C#
VB

Exceptions

SAException
If the custom function has already been registered with the workbook.

 

 

  • No labels