We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ICustomFunction Example


I am looking for an example of the ICustomFunction that actually works in vb.net 2008. The Help on the web site does not give an example only the function. The sample code in the download also does not have it. I'd like to see it work with multiple arguments such as:


This has 3 args. This function could do whatever but for all practical purposes i just want to know how to translate the args data so i can process it into a return value weather it is a string, double, or whatever data type.

Thank you,



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Please try the following sample code and attached template file as per your requirement for utilizing ICutomFunction.

Module modTest

Public Class CustomFunction

Implements Aspose.Cells.ICustomFunction

Function CalculateCustomFunction(ByVal functionName As String, _

ByVal paramsList As System.Collections.ArrayList, _

ByVal contextObjects As System.Collections.ArrayList) As Object _

Implements Aspose.Cells.ICustomFunction.CalculateCustomFunction

Dim firstParamB1 As Decimal = CType(paramsList.Item(0), Decimal)

Dim secondParamC1C25 As Array = CType(paramsList.Item(1), Array)

Dim thirdParamAnyString As String = paramsList.Item(2).ToString()

' perform your processing

Return firstParamB1

End Function

End Class

Sub <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Main()

Const WORKBOOK_NAME As String = "..\..\..\test.xls"

'Open the workbook

Dim wbk As New Aspose.Cells.Workbook


wbk.CalculateFormula(False, New CustomFunction)


'Save the workbook


End Sub

End Module

We will also include the example code to our online documentation soon. Also, we will provide an online demo for it soon.

Thank You & Best Regards,