The Report Data Source Configuration files, introduced in TX Text Control X10, store database connection strings and created data relations. These files can be created in the customizable template designer TX Text Control Words and directly used in the reporting engine MailMerge.

In order to merge a template with data from a database, you simply need to load the template and the RDSC file and to call the Merge method - the rest is done by MailMerge automatically.

TX Text Control's MailMerge component is accessing the database, creating the relations in order to merge the right data into merge fields, blocks, images and barcodes.

This tutorial shows how to create a simple mail merge application with RDSC files.

  1. Create a new Windows Forms application and drag and drop a Text Control from the toolbox onto your form. Open the SmartTag in the upper right corner of TextControl and visit each wizard link to add additional controls and to connect them.

  2. Find the MailMerge component in the toolbox and drag and drop it onto the form. Click the Connect to Text Component wizard link to connect MailMerge to the created TextControl instance.

    Using Report Data Source Configuration files
  3. In the same SmartTag, click Start Template Designer.

  4. In the Mailings ribbon tab, click the Select Data Source button and follow the steps in the dialog to open your desired database.

    Using Report Data Source Configuration files
  5. When the database has been opened, click on Edit Data Relations to the open the Data Relations dialog.

    Using Report Data Source Configuration files
  6. In the dialog, create your data relations by choosing a main and a child table and the column that defines the relation between the two tables.

    Using Report Data Source Configuration files
  7. When the dialog is confirmed and closed with OK, the relations are directly usable in the designer. Click on the drop-down button Insert Merge Field and select your main table. In the opened dialog, you will see the fields of your main table and the related fields of your child table. Insert some fields of both tables into your template.

    Using Report Data Source Configuration files

    Fields from child tables are divided using a '.' which represents table relations.

  8. Make sure that your main table is selected using the Select Master Table drop-down button. From the Config File drop-down button, select Save Configuration and choose a location and name for your configuraton file.

  9. Save the template as DOC, DOCX, RTF or the Internal TX Text Control format using the Save As... menu and close the template designer.

  10. Back in Visual Studio, open the SmartTag of MailMerge and choose TemplateFile... to select your previously saved template.

  11. Now, choose ReportDataSourceConfigFile to browse for your configuration file.

  12. Create a menu by adding a MenuStrip to your form with a main menu named Report and menu item Merge. Double-click Merge and add the following code to the event handler:


Compile and start your application in order to choose Merge from the main menu. Your created template is automatically merged with the specified database and relations.

Want to see this in action? Download the trial version of TX Text Control X10 today and test drive the new way of reporting.