Change Font Family Dynamically in Bold Reports Report Designer
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
-
Click the gray design surface outside the report body to select the report.
-
In the Properties panel, locate the Code property under the Report properties.
-
Click the Code property to open the Code Module editor.
Step 2: Add the Custom Function
-
Include the following VB code in the Code Module editor:
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
-
Select the textbox or tablix cell where the font should change dynamically.
-
In the Properties panel, locate the FontFamily property.
-
Click the expression (fx) button next to the property.
Step 4: Assign the Expression
Set the FontFamily expression as follows:
=Code.getFontType(Fields!lang.Value)
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.
Related Articles
- Working with Custom Code in Bold Reports
- Using Expressions in Bold Reports
- Text Box Properties in Bold Reports
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.