Articles in this section

Change Font Family Dynamically in Bold Reports Report Designer

Published:
Updated:

Bold Reports Report Designer allows you to dynamically change the font family of report items using expressions and the Code Module. This approach is useful when displaying multilingual content or when different font styles are required based on data values. The following example demonstrates how to change the font family based on a language field value.

Steps to Dynamically Change Font Family

Step 1: Open the Code Module

  1. Click the gray design surface outside the report body to select the report.

  2. In the Properties panel, locate the Code property under the Report properties.

  3. Click the Code property to open the Code Module editor.

    image.png

Step 2: Add the Custom Function

  1. Include the following VB code in the Code Module editor:

    image.png

    Public Function getFontType(ByVal lang As String) As String
        Select Case LCase(Trim(lang))
            Case "english"
                Return "Times New Roman"
            Case "hindi"
                Return "Calibri"
            Case "korean"
                Return "Algerian"
            Case Else
                Return "Arial"
        End Select
    End Function
    

The function normalizes the input with LCase and Trim, so English, english, and English all match the same case. The Case Else branch returns a default font (Arial), so an unmatched language still receives a valid font instead of an empty value.

Note: Verify font availability in your deployment environment before publishing reports.

Step 3: Select the Font Family Property

  1. Select the textbox or tablix cell where the font should change dynamically.

  2. In the Properties panel, locate the FontFamily property.

  3. Click the expression (fx) button next to the property.

    image.png

Step 4: Assign the Expression

Set the FontFamily expression as follows:

=Code.getFontType(Fields!lang.Value)

image.png

Note: Replace lang with the appropriate dataset field name if necessary.

Step 5: Preview the Report

Click Preview to verify that the font changes dynamically based on the language value returned from the dataset.

image.png

Related Articles

Summary

By using a Code Module and an expression-based FontFamily property, you can dynamically change fonts in Bold Reports Report Designer based on language values or other business conditions. This approach improves report readability, supports multilingual content, and ensures that the appropriate font is applied automatically at runtime based on the data being displayed.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied