[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.FunctionValueType

FunctionValueType Enum

Specifies the value type of a custom function parameter or result.

Use this enum with Parameter and CustomFunction to declare the kinds of values a custom function accepts or returns, such as numbers, text, logical values, scalar variants, or objects.

Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public enum FunctionValueType
Public Enum FunctionValueType
Examples
AsyncCustomFunction function = new DelayFunction();
Workbook.AddCustomFunction(function, true);
worksheet.Range["A1"].Formula = "=DELAY_SAMPLE(10)";
workbook.Calculate();
workbook.WaitForCalculationToFinish();
object delayedValue = worksheet.Range["A1"].Value;

class DelayFunction : AsyncCustomFunction
{
    public DelayFunction()
        : base("DELAY_SAMPLE", FunctionValueType.Number,
            new Parameter[] { new Parameter(FunctionValueType.Number) })
    {
    }

    protected override Task<object> EvaluateAsync(object[] arguments, ICalcContext context)
    {
        return Task.FromResult(arguments[0]);
    }
}

Fields

Name Description
Boolean

Specifies that value of parameter is bool.

Number

Specifies that value of parameter is number.

Object

Specifies that the parameter value is an object value, including a scalar, an array, or a CalcReference.

If the parameter is retval or acceptCustomObjects, the value can also be a custom object.

Text

Specifies that value of parameter is string.

Variant

Specifies that value of parameter is scalar (number, string, bool, CalcError, null (Nothing in Visual Basic)).