Public Function CustomFunctionCalculate(args As IList(Of ComputationResultFunctionValue), currentCell As Cell) As ComputationResultFunctionValue
Dim result As New StringBuilder("")
For Each arg As ComputationResultFunctionValue In args
If result.Append(",")
Select Case arg.Type
<> ComputationResultType.RANGE Then Case FunctionValueType.[BOOLEAN]
result.Append(If(CBool(arg.Value), "True", "False"))
Exit Select
Case FunctionValueType.[STRING]
result.Append(arg.Value)
Exit Select
Case FunctionValueType.NUMBER
result.Append(CDbl(arg.Value).ToString("0.#####"))
Exit Select
Case FunctionValueType.NULL
result.Append(" ")
Exit Select
Case FunctionValueType.RANGE
result.Append(arg.Value.ToString())
Exit Select
End IfSelect
Next
Return New ComputationResultFunctionValue(result.ToString())
End Function |