Connecting MailMerge to TextControl

Windows Forms User's Guide > Howto: Mail Merge

In Visual Studio, choose Project... from the File -> New main menu in order to create a new Windows Forms Application.

DocumentServer.MailMerge is a separate component located in the TX Text Control 24.0 tab page of the Visual Studio toolbox. Drag and drop an instance of TextControl and MailMerge to the same form. DocumentServer.MailMerge will be added to the component tray area of the Designer View.

Select the MailMerge instance and find the DocumentServer.MailMerge.TextComponent property in the Properties window. In the drop down list, select the TextControl instance you want to connect to the MailMerge component.

Now that the MailMerge component and TextControl are connected, you can start a merge process by calling the DocumentServer.MailMerge.Merge method with an appropriate DataTable object. Automatically, DocumentServer.MailMerge uses the document of the connected TextControl instance as a template. Provided that the used DataTable contains fields that matches the contained ApplicationFields, they are automatically merged and the resulting document is loaded back into TextControl.

The following 3 samples give an overview of different options and usages.