# Mail Merge

> Design an invoice template with the Reporting tab of the WPF ribbon, merge JSON data into merge fields with MailMerge and repeat table rows with merge blocks.

- **Product:** TX Text Control .NET for WPF
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for WPF > Getting Started > Mail Merge
- **694 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/llms-full.txt

---

When many documents share one layout and differ only in their data, such as invoices, letters or reports, mail merge produces them from a template and a data source. Three tutorials walk through one invoice in a WPF ribbon window: the template is designed with the **Reporting** tab of the ribbon, JSON data fills its merge fields, and a merge block turns the invoice items into table rows.

### Choose a Tutorial

| Tutorial | You learn to | Main members |
|---|---|---|
| [Create a Template](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/template/llms-full.txt) | Add the Reporting tab in XAML, give it sample data, insert merge fields and save the template | `RibbonReportingTab`, `DataSourceManager.LoadJson`, `MergeField` |
| [Merge Data into Fields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/fields/llms-full.txt) | Merge JSON data into the template in the background, show the result, save it as PDF and find fields without data | `MailMerge`, `MergeJsonData`, `FieldMerged` |
| [Add Repeating Merge Blocks](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/blocks/llms-full.txt) | Repeat a table row for each item, with the ribbon or in code, and merge business objects | `InsertMergeBlock`, `InsertMergeBlockDialog`, `MergeObject` |

The tutorials share the data *invoice.json* and the template *invoice.docx*, so work through them in the order of the table.

![The Reporting tab of the WPF ribbon with the groups Data Source, Merge Fields, Merge Blocks and View.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-wpf/ribbon-reporting-tab.e14e49fb.webp)

### Before You Start

- Complete [Create a WPF Ribbon Application](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/document-editor/ribbon/llms-full.txt). The tutorials add the Reporting tab to its ribbon and buttons to its window.
- Mail merge and the ribbon are part of the Professional and Enterprise editions. See [Editions and Feature Availability](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/overview/editions/llms-full.txt).
- [MailMerge](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/overview/components/mailmerge/llms-full.txt) in the Overview introduces the component, its data sources and the reporting user interface.

### What Is Specific to WPF

`MailMerge`, `DataSourceManager` and the merge field classes are the same as in the other TX Text Control products. In a WPF window, the differences are in the user interface:

- **The Reporting tab** is a `RibbonReportingTab` in the `Ribbon` of WPF. It is declared in XAML and connected by name in the `RibbonReportingTab` attribute of the `TextControl`.
- **The field navigator** is a `Sidebar` that the tab's `FieldNavigatorSidebar` attribute names. Without it, the tab hides its **Field Navigation** button.
- **The dialog boxes** for merge blocks and data relations are classes of the namespace `TXTextControl.DocumentServer.WPF`, such as `InsertMergeBlockDialog`, which your code can open as well.

### After These Tutorials

- [Mail Merge and Reporting](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/mail-merge/llms-full.txt): data sources, fields, blocks, conditions, formatting and events in detail.
- [PDF Processing](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/pdf/llms-full.txt): add PDF options, forms and signatures to the merged documents.
- [Mail Merge Examples](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/examples/mail-merge/llms-full.txt): complete WPF applications with the Reporting tab.

---

## In This Section

- [Add Repeating Merge Blocks](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/blocks/llms-full.txt): Repeat a table row per invoice item in a WPF template: insert a merge block with the Reporting tab, InsertMergeBlock or InsertMergeBlockDialog, merge objects.
- [Merge Data Into Fields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/fields/llms-full.txt): Merge JSON data into a DOCX template with MailMerge and ServerTextControl in a WPF window, show the result in the editor, save a PDF and list unmerged fields.
- [Create a Template](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/template/llms-full.txt): Add the RibbonReportingTab in XAML, load JSON sample data with DataSourceManager, insert merge fields with the ribbon or in code and show the field navigator.

---

## Nearby

- **Previous:** [Print a Document](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/document-processing/print/llms-full.txt)
- **Next:** [Create a Template](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/mail-merge/template/llms-full.txt)
