Use custom code from the template

In the following example, you create a function to replace the word "Bike" with "Bicycle".

  1. In the Report Properties, select the Code page.

  2. Enter a valid Visual Basic function. For example:

    Public Function ChangeWord(ByVal s As String) As String

    Dim strBuilder As New System.Text.StringBuilder(s)

    If s.Contains("Bike") Then

    strBuilder.Replace("Bike", "Bicycle")

    Return strBuilder.ToString()

    Else : Return s

    End If

    End Function

  3. Add a text field to your template, and edit the value. Code defined in the Report Properties will be listed in the Expression Editor under Custom Code. Use the following expression:

  4. =Code. ChangeWord("I like Bike")

In the report preview, the text will be shown as "I like Bicycle".