Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

The IFunction interface is used to implement custom excel functions in .Net to be passed in to ExcelWriter Application

Signature
C#
C#
public interface IFunction
{
    ComputationResult CustomFunction(IList<ComputationResult> args, Cell currentCell);
}
Signature
vb.net
vb.net
Public Interface IFunction
    Function CustomFunction(IList<ComputationResult> args, Cell currentCell) As ComputationResult
End Interface
Example
Code Block
csharp
csharp
titleC#
class Concat : IFunction
{
    public ComputationResult CustomFunction(IList<ComputationResult> args, Cell currentCell)
    {
        StringBuilder result = new StringBuilder("");


        foreach (ComputationResult arg in args)
            if (arg.Type != ComputationResultType.RANGE)
                result.Append(arg);


        return new ComputationResult(result.ToString());
    }
}
Code Block
vbnet
vbnet
titlevb.net
Class Concat
	Implements IFunction
	Public Function CustomFunction(args As IList(Of ComputationResult), currentCell As Cell) As ComputationResult
		Dim result As New StringBuilder("")
		For Each arg As ComputationResult In args
			If arg.Type <> ComputationResultType.RANGE Then
				result.Append(arg)
			End If
		Next
		Return New ComputationResult(result.ToString())
	End Function
End Class

Methods

Name

Description

CustomFunction(IList<ComputationResult>,Cell)

Excerpt Include
IFunction.CustomFunction
IFunction.CustomFunction
nopaneltrue

Scrollbar