Skip to main content

ASPxSpreadsheet.RegisterGlobalCustomFunction(ICustomFunction) Method

Registers the specified global custom function.

Namespace: DevExpress.Web.ASPxSpreadsheet

Assembly: DevExpress.Web.ASPxSpreadsheet.v24.1.dll

NuGet Package: DevExpress.Web.Office

Declaration

public static void RegisterGlobalCustomFunction(
    ICustomFunction customFunction
)

Parameters

Name Type Description
customFunction ICustomFunction

An object that supports the ICustomFunction interface.

Remarks

To create a custom function:

  • Create a class that implements the ICustomFunction interface and performs the required calculations.
  • Register the function using the static RegisterGlobalCustomFunction method - pass an instance of your function-implementation class as the method’s parameter.

It is recommended that you register custom functions only once at the application level. The following code illustrates how this can be done in the Global.asax file’s Application_Start method.

void Application_Start(object sender, EventArgs e) {
    ...
    ASPxSpreadsheet.RegisterGlobalCustomFunction(new DiscountFunction());
    ...
}

To see the complete implementation of a custom function, refer to the Global Custom Functions online demo.

See Also