TX Text Control .NET for WPF

Mail Merge and Reporting

Topic

Developers of WPF applications who create documents from data, such as invoices, contracts, letters and reports, find everything about templates and merging collected here. Users design a template in the TextControl of a window with the Reporting ribbon tab, and the MailMerge class, created in your code, fills it with data in the editor or in a ServerTextControl in the background. Once through, you know how data, fields and blocks fit together, how to shape and format the result and how the designer and the merge events work.

The tutorials of Getting Started: Mail Merge build a first template and merge it, and MailMerge in the Overview introduces the class. Mail merge requires the Professional or Enterprise edition; see Editions and Feature Availability.

How Mail Merge Works

Three parts come together in a merge:

  • The template, an ordinary document designed in the Reporting tab, in MS Word or in code, holds merge fields for single values, merge blocks for repeated and optional parts, special fields such as IF and INCLUDETEXT, and image and barcode placeholders.
  • The data arrives as business objects, a DataSet, JSON or XML, shaped like the document, with names that match the fields and blocks.
  • MailMerge merges the data into the template of a WPF.TextControl or a ServerTextControl. The result appears in the editor or is saved as PDF, DOCX or another format, as one document or one per record.

Layout and rules stay in the template, so a designer can change them without a change to your code.

The Reporting tab of the WPF ribbon with the groups Data Source, Merge Fields, Merge Blocks and View

Find the Right Page

If you want toRead
Understand the reporting model, merge in the editor or in the background, create one document per recordOverview
Merge business objects, DataSets, JSON or XMLData Sources
Format numbers and dates, add text before and after a value, insert date fieldsMerge Fields
Repeat table rows or sections for each recordMerge Blocks
Build master-detail reports with blocks inside blocksNested Blocks and Master-Detail Reports
Reuse terms, letterheads or address blocks in many templatesSubtemplates
Merge logos, photos, QR codes and barcodesImages and Barcodes
Include text and sections only when the data calls for themConditional Content
Merge the rows of a block in order and only the rows you needSorting and Filtering
Color rows, highlight values or calculate totals in merged tablesFormatting and Styling
Design, store and test templates that hold up with real dataTemplate Design
Know every button and dialog box of the WPF Reporting tab, or open them from your codeReporting Ribbon and WPF Dialog Boxes
Show designers the merged result in the editorTemplate Preview
Follow, change or cancel a merge in its eventsMerge Events

Pages in This Section