Skip to main content

Create a Letter

  • 2 minutes to read

This tutorial describes the steps to create a mail merge report, in which data fields are embedded into a label’s text that is replaced with corresponding data values on preview or export.

Do the following to create a mail merge report:

  1. Start Microsoft Visual Studio 2012, 2013, 2015, 2017, or 2019 and create a new application under any of the supported platforms, or open an existing one.
  2. Add a new blank report to it.
  3. Bind the report to the “SalesPerson” view of the sample Northwind database (nwind.mdb[1] file, which is shipped with the XtraReports installation).
  4. Drop the XRRichText control from the DX.22.1: Report Controls Toolbox tab onto the Detail band.

    How to -  CreateStaticReport_0

  5. Add the required text to the control and embed data fields’ names into it, surrounded by [square brackets], as shown in the following image:

    HowTo - MailMergeReport_0

To apply a formatting to the embedded data fields, set the cursor to a field’s name inside the square brackets, and click the control’s smart tag. In the invoked actions list, define the required value for the Format String property.

HowTo - MailMergeReport_1

  1. If your project in Visual Studio 2022 has to connect to Microsoft Access databases, note that Visual Studio 2022 is a 64-bit process, and Microsoft OLE DB Provider for Jet and the Jet ODBC driver are only available in 32-bit versions. It is recommended that you use the 64-bit Microsoft Access Database Engine (Access Connectivity Engine, ACE), or use an earlier version of Visual Studio (VS 2019) that supports 32-bit database providers. For more information, review the following article: Connect to data in an Access database.