Conditionally Format a Row to Bold Font in Reports

In some reports, you may want to format rows as bold based on the value of a field in the row. For example, in the CRONUS International Ltd. demonstration database, on report 1, Chart of Accounts, you could conditionally specify that rows whose account type is Posting are bold and rows whose account type is anything other than Posting are not bold.

To conditionally change rows to bold font

  1. In the development environment, on the Tools menu, choose Object Designer.

  2. In Object Designer, choose Report, select the report that you are modifying, and then choose Design.

  3. On the View menu, choose Layout.

  4. In Visual Studio, create a hidden text box. The hidden text box should contain the field on which you will determine whether the row is bold. For example, in the Chart of Accounts report, the hidden field contains the account type field. For more information, see How to: Add and Identify Hidden Fields.

  5. In design view, select the data row that you want to appear as bold.

  6. In the Properties window, expand Font. In the FontWeight field, select <Expression…> from the drop-down list.

  7. In the Expression window, clear the expression text box, and then select Fields(DataSet_Result) from the Category list. Under Values, double-click the field on which you will determine whether the row is bold.

  8. In the text box at the top of the Expression window, use the field that you selected in step 7to create a conditional statement. For example, the following is a conditional statement for report 1.

    =IIf(Fields!G_L_Account___Account_Type_.Value="1","Normal","Bold")

  9. On the File menu, choose Save Report.rdlc.

See Also

Designing Reports