Message-ID: <62474244.8863.1711665166868.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8862_1480255877.1711665166868" ------=_Part_8862_1480255877.1711665166868 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html IFunction.Calculate

IFunction.Calculate

Description

Calculates a custom function returning a=20 FunctionValue given a list of F= unctionValue arguments and the function's current=20 Cell for context.=20
C#
=20
FunctionValue Calculate(IList<FunctionValue&=
gt; args, Cell currentCell)
=20
=20
vb.net
=20
Function Calculate(args As IList(Of FunctionValu=
e), currentCell As Cell) As FunctionValue
=20

Parameters

=20
args
An ordered list of=20 FunctionValue = arguments that have already been fully evaluated.=20
currentCell
The=20 Cell that the current f= unction resides in to use for context sensitive operations=20

Returns

A FunctionValue that co= ntains the resulting value of the function.=20

Examples

=20
C#
=20
        public FunctionValue Calculate(IList<FunctionValue>=
; args, Cell currentCell)
        {
            StringBuilder result =3D new StringBuilder("");
            foreach (FunctionValue arg in args)
            {
                result.Append(',');
                switch (arg.Type)
                {
                    case FunctionValueType.BOOLEAN:
                        result.Append((bool)arg.Value ? "True" : =
"False");
                        break;
                    case FunctionValueType.STRING:
                        result.Append(arg.Value);
                        break;
                    case FunctionValueType.NUMBER:
                        result.Append(((double)arg.Value).ToString("0.=
#####"));
                        break;
                    case FunctionValueType.NULL:
                        result.Append(' ');
                        break;
                    case FunctionValueType.RANGE:
                        result.Append(arg.Value.ToString());
                        break;
                }
            }
            return new FunctionValue(result.ToString());
        }
=20
vb.net
=20
    Public Function Calculate(args As IList(Of FunctionValue), c=
urrentCell As Cell) As FunctionValue
        Dim result As New StringBuilder("")
        =20
        For Each arg As FunctionValue In args
            result.Append(",")
=20
            Select Case arg.Type
                Case FunctionValueType.[BOOLEAN]
                    result.Append(If(CBool(arg.Value), "True", &q=
uot;False"))
                    Exit Select
                Case FunctionValueType.[STRING]
                    result.Append(arg.Value)
                    Exit Select
                Case FunctionValueType.NUMBER
                    result.Append(CDbl(arg.Value).ToString("0.#####&qu=
ot;))
                    Exit Select
                Case FunctionValueType.NULL
                    result.Append(" ")
                    Exit Select
                Case FunctionValueType.RANGE
                    result.Append(arg.Value.ToString())
                    Exit Select
            End Select
        Next
        Return New FunctionValue(result.ToString())
    End Function
=20
------=_Part_8862_1480255877.1711665166868--