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.v19.1.Core.dll
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 illustrates the use of the ICustomFunctionDescriptionsRegisterService
service for the SPHEREMASS custom function defined in the WinForms SpreadsheetControl API - Part 2 example available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4832.
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);
}