# FormattedText Control for Mail Merge

This is a tutorial on how to create a mail merge report that uses the FormattedText control to display the discount percent, start date, and end date for different sales promotions.

## Content



Let's create a mail merge report that uses the **FormattedText** control to display the discount percent, start date, and end date for different sales promotions. We will use the List data region to repeat the data in the FormattedText control for each unique promotion key in the dataset.

The final report will look as shown.

![Mail Merge Report with FormattedText](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/design-reports/formatted-text.png)

### Create a Report

In the ActiveReports Designer, create a new RDLX report.


> type=note
> If you are creating a new report in the Visual Studio Integrated Designer, see [Quick Start](/activereportsnet/docs/report-authors/standalone-designer-app/create-multi-section-rdl).

### Bind Report to Data

As you create a new report, you can configure the report data connection in the Report Wizard. You can also access the **Report Data Source** dialog by right-clicking the Data Sources node in the Report Explorer and then selecting the **Add Data Source** option. See [JSON](/activereportsnet/docs/report-authors/data-binding/data-binding-page-rdl-reports/connect-to-a-data-source/json) for details.

1.  On the **Choose Data Source Type** screen of the wizard, select **JSON** and click **Next.**
2.  To specify JSON **File Path**, click the **Browse** button and navigate to the desired file on your system. This report uses the 'DimPromotions.json' sample data source that can be downloaded from the following URL:<br />[https://demodata.mescius.io/contoso/odata/v1/DimPromotions](https://demodata.mescius.io/contoso/odata/v1/DimPromotions)
3.  Click the **Next** option and configure the dataset by adding a valid query. Enter PromotionDataset into the **Name** field and select the node from the data tree in the **Path** section to generate the path. The resulting query is displayed in the **Query** field.
4.  Click **Finish** to successfully add the report with the JSON data source.

### Design Report

1.  Drag and drop the **List** data region on the design area.
2.  With the List data region selected, set the **DataSetName** as the name of the dataset, 'PromotionDataset'.
3.  Go to the **Property dialog** and set the **Detail Grouping** to expression =Fields!PromotionKey.Value
4.  Now, drag and drop the **FormattedText** control on the List data region. Check from the Report Explorer that the FormattedText is nested within the List data region.
5.  To encode mail merge fields, go to the **MailMergeFields** property and click ellipses next to (Collections).
6.  In the **Mail Merge** dialog, check the **Encode Mail Merge Fields** option and add the mail merge fields with the following 'Field' and 'Value' pairs:
    *   Field1: PromotionName, Value: =Fields!PromotionName.Value
    *   Field2: DiscountPercent, Value: =Fields!DiscountPercent.Value \* 100
    *   Field3: StartDate, Value: =Format(Fields!StartDate.Value, "dd-MM-yyyy")
    *   Field4: EndDate, Value: =Format(Fields!EndDate.Value, "dd-MM-yyyy")
7.  Set the control's **Html** property to the following text.<br />
    
    ```html
    <!DOCTYPE html>
     
    <html lang="en">
          
       <head>           
          <title>Mail Merge Report</title>          
       </head>
               
       <body bgcolor="#E23940">  
          <h2 style="color:white; text-align:center;font-family:Segoe UI;"><% PromotionName /%></h2>                  
          <h1 style="color:white;text-align:center;font-size:50px; font-family:Segoe UI;">GET<br><big><% DiscountPercent /%>%</big> OFF</h1>                  
          <h2 style="background-color:white;color:#E23940;text-align:center;font-size=35px;font-family:Segoe UI;font-weight:bold">LIMITED PERIOD OFFER</h2>                  
          <h4 style="color:white;text-align:center;font-size=35px;font-family:Segoe UI;">* Valid from <%StartDate /%> to <% EndDate /%> in all our stores. Cannot be combined with any other offers. No cash value. Northwind Traders can cancel promotion at any time.</h4>
          <img align="center" src="https://demodata.mescius.io/images/NorthWind_large.png" style="width:1.5inin;height:2in" />              
       </body>
       
    </html>
    ```
    
8.  Improve the appearance of the controls and preview the report.<br />

## See Also

[FormattedText](/activereportsnet/docs/report-authors/report-controls/report-controls-page-rdl-report/formattedtext)