# MailMerge Improvements in X14: Event Arguments and JSON Data Sources

> TX Text Control X14 MailMerge introduces the MergeJsonData method for merging JSON strings directly into reporting templates. New event arguments expose DataRowAdapter, DataTableAdapter, and FieldMergedEventArgs with MergeBlockName and NestingDepth for custom merge process logic.

- **Author:** Bjoern Meyer
- **Published:** 2016-11-01
- **Modified:** 2026-07-17
- **Description:** TX Text Control X14 MailMerge introduces the MergeJsonData method for merging JSON strings directly into reporting templates. New event arguments expose DataRowAdapter, DataTableAdapter, and FieldMergedEventArgs with MergeBlockName and NestingDepth for custom merge process logic.
- **2 min read** (319 words)
- **Tags:**
  - Mail Merge
  - Release
  - Reporting
- **Web URL:** https://www.textcontrol.com/blog/2016/11/01/mailmerge-improvements-in-x14-event-arguments-and-json-data-sources/
- **LLMs URL:** https://www.textcontrol.com/blog/2016/11/01/mailmerge-improvements-in-x14-event-arguments-and-json-data-sources/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2016/11/01/mailmerge-improvements-in-x14-event-arguments-and-json-data-sources/llms-full.txt

---

In version X14 (24.0), the MailMerge class will be improved with new features and enhancements. The [MailMerge](https://docs.textcontrol.com/textcontrol/windows-forms/ref.txtextcontrol.documentserver.mailmerge.class.htm) class is a .NET component that can be used to effortlessly merge template documents with database content in all .NET projects, such as ASP.NET web applications, web services or Windows services.

Merge with JSON Data
--------------------

The new method *MergeJsonData* merges a JSON string into reporting templates. The JSON data can contain either a single object or an array of equally structured objects (JSON array). The following code snippet merges one merge field (*test*) with JSON data:

```
MailMerge mailMerge = new MailMerge();
mailMerge.TextComponent = textControl1;

string json = "{ \"test\":\"TextTest\" }";
mailMerge.MergeJsonData(json);
```

MailMerge Events
----------------

The Text Control Reporting Framework is a very flexible framework to merge data into MS Word compatible templates. With a single line of code, the merge process can be started to generate Adobe PDF or MS Word documents.

In order to manipulate the merge process and to inject custom logic, each merge element such as merge fields and merge blocks fire events. These events return the merged field, information about the location of a field and provide access to data that is used to merge the document.

In these events, a *DataRowAdapter* provides access to the *DataTableAdapter* which gains access to the child table names, column names, the DataTable, the data rows and the table name. Additionally, the new *FieldMergedEventArgs* property *MergeBlockName* returns the block name in case the field is embedded in a merge block. The *NestingDepth* property returns the nesting level of the field.

These new properties allow a very flexible interaction with the merge process.

![MailMerge improvements in X14: Event arguments and JSON data sources](https://s1-www.textcontrol.com/assets/dist/blog/2016/11/01/a/assets/diagram_mailmerge.webp "MailMerge improvements in X14: Event arguments and JSON data sources")Stay tuned for more details!

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [MailMerge: Conditional Rendering of Merge Blocks](https://www.textcontrol.com/blog/2018/11/28/mailmerge-conditional-rendering-of-merge-blocks/llms.txt)
- [DataSourceManager: Using the Ready-to-Use Reporting Dialog Boxes](https://www.textcontrol.com/blog/2018/11/27/datasourcemanager-using-the-ready-to-use-reporting-dialog-boxes/llms.txt)
- [Merge Blocks in X16: Filtering, Sorting and Conditional Rendering](https://www.textcontrol.com/blog/2018/11/22/merge-blocks-in-x16-filtering-sorting-and-conditional-rendering/llms.txt)
- [Preview: JSON Support in MailMerge Version X14 (24.0)](https://www.textcontrol.com/blog/2016/05/18/preview-json-support-in-mailmerge-version-x14-240/llms.txt)
- [TX Text Control 32.0 Has Been Released](https://www.textcontrol.com/blog/2023/09/13/tx-text-control-320-has-been-released/llms.txt)
- [TX Text Control 31.0 and TX Spell .NET 10.0 Have Been Released](https://www.textcontrol.com/blog/2022/09/07/tx-text-control-31-released/llms.txt)
- [TX Text Control 30.0 and TX Spell .NET 9.0 Have Been Released](https://www.textcontrol.com/blog/2021/11/29/tx-text-control-30-released/llms.txt)
- [TX Text Control X19 and TX Spell 8.0 Have Been Released](https://www.textcontrol.com/blog/2020/12/02/tx-text-control-x19-released/llms.txt)
- [TX Text Control for Angular X18 Published](https://www.textcontrol.com/blog/2020/03/18/tx-text-control-for-angular-x18-published/llms.txt)
- [MVC NuGet Packages for X18 Published](https://www.textcontrol.com/blog/2020/03/17/mvc-nuget-packages-for-x18-published/llms.txt)
- [TX Text Control X18 has been Released](https://www.textcontrol.com/blog/2020/03/16/tx-text-control-x18-released/llms.txt)
- [Sneak Peek X18: Form Field Conditional Instructions](https://www.textcontrol.com/blog/2020/01/03/sneak-peek-x18-form-field-conditional-instructions/llms.txt)
- [DocumentViewer: New Two Page View Mode](https://www.textcontrol.com/blog/2020/01/02/documentviewer-new-two-page-view-mode/llms.txt)
- [MailMerge Class Settings Explained](https://www.textcontrol.com/blog/2019/12/05/mailmerge-settings-explained/llms.txt)
- [See Text Control at DDC in Cologne](https://www.textcontrol.com/blog/2019/11/24/see-text-control-at-ddc-in-cologne/llms.txt)
- [Impressions from DEVintersection Fall 2019](https://www.textcontrol.com/blog/2019/11/22/impressions-from-devintersection-fall-2019/llms.txt)
- [Impressions from TechBash 2019](https://www.textcontrol.com/blog/2019/11/14/impressions-from-techbash-2019/llms.txt)
- [Merge Excel Documents into MailMerge Templates using IncludeText Fields](https://www.textcontrol.com/blog/2019/08/13/merge-excel-documents-into-mailmerge-templates/llms.txt)
- [MailMerge: Conditional Table Cell Colors using Filter Instructions](https://www.textcontrol.com/blog/2019/06/06/mailmerge-conditional-table-cell-colors-using-filter-instructions/llms.txt)
- [MailMerge: Using Filters to Remove Unwanted Rows](https://www.textcontrol.com/blog/2019/06/04/mailmerge-using-filters-to-remove-unwanted-rows/llms.txt)
- [TX Text Control X17 has been Released](https://www.textcontrol.com/blog/2019/05/28/tx-text-control-x17-released/llms.txt)
- [Text Control Roadmap 2019: High DPI Support, Forms, Node.js and Angular](https://www.textcontrol.com/blog/2019/03/12/text-control-roadmap-2019/llms.txt)
- [Impressions from BASTA! Spring 2019](https://www.textcontrol.com/blog/2019/03/01/impressions-from-basta-spring-2019/llms.txt)
- [Impressions from NDC London 2019](https://www.textcontrol.com/blog/2019/02/04/impressions-from-ndc-london-2019/llms.txt)
- [ReportingCloud: Backend Updated to TX Text Control X16](https://www.textcontrol.com/blog/2019/01/03/impact-of-the-azure-reboot-strategy/llms.txt)
