Search Results for

    Show / Hide Table of Contents

    TUserDefinedFunction Class

    Inherit from this class to create your own user defined functions. Make sure you read 'Using Excel's user defined functions (UDF)' in the Api Developer Guide to get more information on what user defined functions are and how they are created.

    Syntax

    Namespace: FlexCel.Core

    public abstract class TUserDefinedFunction

    Constructors

    Name Description
    TUserDefinedFunction Overloaded
    TUserDefinedFunction(String)
    TUserDefinedFunction(String, String)

    Methods

    Name Description
    Evaluate Override this method to provide your own implementation on the function.

    If this method throws an exception, it will not be handled and the recalculation will be aborted. So if you want to return an error, return a TFlxFormulaError​Value value.


    Do not use any global variable in this method, it must be stateless and always return the same value when called with the same arguments.


    See 'Using excels user defined functions udf' in the Api Developer Guide...[more]
    CheckParameters Checks that the parameter array has the expected number of arguments, and that no one is an Error. If any argument is an error it is returned in ResultError, since the default in Excel is to stop processing arguments in a function when one is an error.
    GetSingleParameter Returns a single value from a parameter.
    If the parameter is a cell range and the cell range has only one cell, this method will return the value of the cell, else it will return an error.
    TryGetDouble Tries to retrieve a double from a parameter, and return it if it can be converted or an error if not.
    TryGetDate Tries to retrieve a date/time from a parameter, and return it if it can be converted or an error if not.
    TryGetDoubleList Tries to retrieve a list of double arguments from the parameters, starting at parameter startParam.
    Use this method for functions that accept a range of numeric values as an entry. (for example =Sum(a1:a10))
    TryGetString Tries to retrieve a string from a parameter, and return it if it can be converted or an error if not.
    TryGetBoolean Tries to retrieve a boolean from a parameter, and return it if it can be converted or an error if not.
    TryGetCellRange Tries to retrieve a cell range from a parameter, and return it if it can be converted or an error if not.
    TryGetArray Tries to retrieve an array from a parameter, and return it if it can be converted or an error if not.

    Properties

    Name Description
    Name Name that will be assigned to the function.
    InternalName Name that will be used when saving xls (biff8) files. Some functions are saved by Excel 2010 as .xlfn_Name when saving xls (not xlsx). This is the name that should be saved in the xls file, not the real name of the function.
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com