Back to Devexpress

ICustomFunctionDescriptionsRegisterService.RegisterFunctionDescriptions(String, String, CustomFunctionArgumentsDescriptionsCollection) Method

officefileapi-devexpress-dot-spreadsheet-dot-functions-dot-icustomfunctiondescriptionsregisterservice-dot-registerfunctiondescriptions-x28-string-string-customfunctionargumentsdescriptionscollection-x29.md

latest4.9 KB
Original Source

ICustomFunctionDescriptionsRegisterService.RegisterFunctionDescriptions(String, String, CustomFunctionArgumentsDescriptionsCollection) Method

Specifies text descriptions for use in the Function Argument dialog invoked for the specified custom function.

Namespace : DevExpress.Spreadsheet.Functions

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void RegisterFunctionDescriptions(
    string functionName,
    string functionDescription,
    CustomFunctionArgumentsDescriptionsCollection argumentsDescriptions
)
vb
Sub RegisterFunctionDescriptions(
    functionName As String,
    functionDescription As String,
    argumentsDescriptions As CustomFunctionArgumentsDescriptionsCollection
)

Parameters

NameTypeDescription
functionNameString

A string that is the name of a custom function for which descriptions are specified. The function name is defined by the IFunction.Name property.

| | functionDescription | String |

A string that describes the custom function itself.

| | argumentsDescriptions | CustomFunctionArgumentsDescriptionsCollection |

A collection of descriptions for the function arguments.

|

Example

This example shows how to use ICustomFunctionDescriptionsRegisterService for the SPHEREMASS custom function defined in the following example: Spreadsheet Document API Examples.

csharp
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);
}
vb
Dim customFunction As New SphereMassFunction()
If (Not workbook.CustomFunctions.Contains(customFunction.Name)) Then
    workbook.CustomFunctions.Add(customFunction)
    ' Get a service to specify the function description.
    Dim service As ICustomFunctionDescriptionsRegisterService = CType(workbook.GetService(GetType(ICustomFunctionDescriptionsRegisterService)), ICustomFunctionDescriptionsRegisterService)
    If service Is Nothing Then
        Return
    End If
    Dim arguments As 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)
End If

See Also

ICustomFunctionDescriptionsRegisterService Interface

ICustomFunctionDescriptionsRegisterService Members

DevExpress.Spreadsheet.Functions Namespace