The Formatted Text control can perform mail merge operations, and it displays richly formatted text in HTML. You can format the Formatted Text report control, by entering the HTML code into the Html property. You can freely expand the content of the report through HTML coding.
This section describes how to use a Formatted Text control in a report.
Follow the below steps to add a Formatted Text control.
From the Report Toolbox on the left, either drag and drop the Formatted Text control onto the design area or left click the control.
You can also add it to the List control.
You can set the properties of the control. For this, select the control and click the Properties tab. The list of properties related to the Formatted Text control is displayed.
You can set the Formatted Text control appearance by setting properties in the Properties tab. Properties like adding a border, layout, visibility, etc. can be customized.
Listed below are the common properties.
In the example below, we will create a mail merge report that will use the Formatted Text control to display the product, discount percent, start date, and end date for different products. We will use the List control to repeat the data in the Formatted Text control for each unique product key in the dataset.
Example: Steps to create a mail merge report.
Drag and drop a List control onto the design area of the report and bind it to a dataset.
Click the Properties tab and select the Data Set Name under the Data section.
Under the Group section, add the Group Expressions by clicking the plus sign.
Click the Data Binding and select the ProductKey field from the data set.
Now, drag and drop the Formatted Text control on the List data region. Check from the Report Explorer that the Formatted Text is nested within the List data region.
Set Encode Mail Merge field to True.
Add the Merge Fields. Click the Add Item icon and click the Data Binding option and select the mail merge fields from the dataset with the following 'Field Name' and 'Value' pairs:
Field Name: Field1, Value: = Product
Field Name: Field2, Value: = Discount
Field Name: Field3, Value: = Start Date
Field Name: Field4, Value: = End Date
Set the Html property by clicking the Data Binding option and then selecting the Expression option.
The Expression Editor is displayed.
You can add the HTML code in the expression editor. We have added the following code.
Format the appearance of the report control and preview it.
The report will look as shown below.