ICustomFunctionDescriptionsRegisterService Interface
Provides captions and text descriptions for the Function Argument dialog invoked for the custom function (UDF).
Namespace: DevExpress.Spreadsheet.Functions
Assembly: DevExpress.Spreadsheet.v23.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Remarks
To get the service of the ICustomFunctionDescriptionsRegisterService type, use the GetService<T> method of the workbook.
To specify function and argument descriptions for a specific custom function, call the ICustomFunctionDescriptionsRegisterService.RegisterFunctionDescriptions method. The method requires a CustomFunctionArgumentsDescriptionsCollection object that is the collection of items containing the type and description for each argument. The order of argument descriptions in the collection is the same as the order of arguments in the function signature.
Example
This example shows how to use ICustomFunctionDescriptionsRegisterService
for the SPHEREMASS custom function defined in the following example: Spreadsheet Document API Examples.
SphereMassFunction customFunction = new SphereMassFunction();
if (!workbook.CustomFunctions.Contains(customFunction.Name))
{
workbook.CustomFunctions.Add(customFunction);
// Get a service to specify the function description.
ICustomFunctionDescriptionsRegisterService service = (ICustomFunctionDescriptionsRegisterService)workbook.GetService(typeof(ICustomFunctionDescriptionsRegisterService));
if (service == null)
return;
CustomFunctionArgumentsDescriptionsCollection arguments = new CustomFunctionArgumentsDescriptionsCollection();
arguments.Add(new CustomFunctionArgumentDescription("Radius", "Radius of a sphere, m", "number"));
arguments.Add(new CustomFunctionArgumentDescription("Density", "Material density, kg/m3", "number"));
service.RegisterFunctionDescriptions("SPHEREMASS", "Calculates the mass of a sphere made of a certain material.", arguments);
}