Articles in this section
Category / Section

Dynamically Changing Font Family Based on Conditions in a Report Using Bold Reports' Code Module


Dynamically change the text’s font family based on certain conditions in expressions. This allows you to customize the appearance of your report and improve its readability. Follow these steps to learn how to accomplish this.

Using the Code Module, change the text font family based on a condition in the report. Follow these steps to alter the font family of the text dynamically.

  1. Click on the code in the Properties section of the report.

  2. Include the following VB code snippet inside the code editor. This code is designed to change the font family based on the value of the lang field.


Public Function getFontType(ByVal lang As String) As String
      If lang = "english" Then
          Return "Times New Roman"
      ElseIf lang = "hindi" Then
          Return "Calibri"
      ElseIf lang = "korean" Then
          Return "Algerian"
      End If
End Function
  1. Locate the option to set the font family for the text.


  2. Set the expression for the font family in the tablix cell, like below.


  3. Replace the existing font family value with an expression that calls the getFontType function, passing the relevant language value as the parameter. For example:

  1. Apply the changes and preview the report to see the dynamically altered font family based on the condition specified in the code module.

Note: Modify the code snippet as needed to include additional language options and corresponding font family values based on your specific requirements.

By following these steps and using the provided VB code snippet, you can customize the font family of text in your report dynamically, improving its readability and appearance based on specific conditions.

Was this article useful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied