Message-ID: <1058801039.8353.1711643013757.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8352_1153599165.1711643013757" ------=_Part_8352_1153599165.1711643013757 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
public interface IFunction { FunctionValue Calculate(IList<FunctionValue> args, Cell currentCe= ll); }=20
Public Interface IFunction Function Calculate(args As IList(Of FunctionValue), currentCell As Cell= ) As FunctionValue End Interface=20
class Concat : IFunction { =09//Your custom function should be called Calculate and have the same sign= ature as the sample function below=20 public FunctionValue Calculate(IList<FunctionValue> args, Cel= l currentCell) { =09 //Implement the custom logic you want to calculate your custom/overr= idden Excel function=20 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; } } //Must return a FunctionValue object return new FunctionValue(result.ToString()); } }=20
Class Concat =09Implements IFunction =09//Your custom function should be called Calculate and have the same sign= ature as the sample function below=20 =09Public Function Calculate(args As IList(Of FunctionValue), currentCell A= s Cell) As FunctionValue =09 //Implement the custom logic you want to calculate your custom/o= verridden Excel function =09=09 Dim result As New StringBuilder("") =09=09For Each arg As FunctionValue In args =09=09=09result.Append(",") =09=09=09Select Case arg.Type =09=09=09=09Case FunctionValueType.[BOOLEAN] =09=09=09=09=09result.Append(If(CBool(arg.Value), "True", "F= alse")) =09=09=09=09=09Exit Select =09=09=09=09Case FunctionValueType.[STRING] =09=09=09=09=09result.Append(arg.Value) =09=09=09=09=09Exit Select =09=09=09=09Case FunctionValueType.NUMBER =09=09=09=09=09result.Append(CDbl(arg.Value).ToString("0.#####")) =09=09=09=09=09Exit Select =09=09=09=09Case FunctionValueType.NULL =09=09=09=09=09result.Append(" ") =09=09=09=09=09Exit Select =09=09=09=09Case FunctionValueType.RANGE =09=09=09=09=09result.Append(arg.Value.ToString()) =09=09=09=09=09Exit Select =09=09=09End Select =09=09Next =09=09//Must return a FunctionValue object =09=09Return New FunctionValue(result.ToString()) =09End Function End Class=20
Name |
Description |
---|---|
Calculates a custom function returning a FunctionValue given a list of Function= Value arguments and the function's current C= ell for context. |