# X19 Sneak Peek: Manipulating MergeBlockInfo Objects

> TX Text Control X19 provides the possibility to retrieve and manipulate information of an existing MailMerge merge block. This enables the editing of filters and sorting instructions programmatically.

- **Author:** Bjoern Meyer
- **Published:** 2020-11-17
- **Modified:** 2025-11-16
- **Description:** TX Text Control X19 provides the possibility to retrieve and manipulate information of an existing MailMerge merge block. This enables the editing of filters and sorting instructions programmatically.
- **2 min read** (317 words)
- **Tags:**
  - ASP.NET
  - MailMerge
  - Release
  - Windows Forms
  - WPF
- **Web URL:** https://www.textcontrol.com/blog/2020/11/17/x19-sneak-peek-manipulating-mergeblockinfo-objects/
- **LLMs URL:** https://www.textcontrol.com/blog/2020/11/17/x19-sneak-peek-manipulating-mergeblockinfo-objects/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2020/11/17/x19-sneak-peek-manipulating-mergeblockinfo-objects/llms-full.txt

---

Typically, a merge block is used to repeat content such as table rows. The MailMerge class is using the hierarchical data to repeat the content and to populate fields with data in that block. This merge block provides 3 different options that can be controlled:

- Filters
- Sorting
- Rendering conditions

Those options can be defined through a dialog box or when adding a merge block programmatically through the MergeBlockInfo class.

### MergeBlockInfo Class

An extension in version X19 provides a way to create a *MergeBlockInfo* instance based on an existing merge block SubTextPart.

Consider the following JSON string as the data source:

```
[
  {
    "items": [
      {
        "id": 1,
        "status": "",
        "calibrated": 1521135120000,
        "location": {
          "latitude": -117.125,
          "longitude": 31.125
        }
      },
      {
        "id": 2,
        "status": "offline",
        "calibrated": 1521638100000,
        "location": {
          "latitude": -113.325,
          "longitude": 33.325
        }
      },
      {
        "id": 3,
        "status": "error",
        "calibrated": 1522291320000,
        "location": {
          "latitude": -111.625,
          "longitude": 35.625
        }
      }
    ]
  }
]
```

The following screenshot shows a nested merge block including the blocks *items* and *location*:

![Merge Blocks](https://s1-www.textcontrol.com/assets/dist/blog/2020/11/17/a/assets/mergeblock.webp "Merge Blocks")

The inner merge block *location* should be only rendered, if the *id* of the parent block (*items*) is > 1.

### Manipulate MergeBlock Conditions

The following code shows how to retrieve a *SubTextPart* and to create a new *MergeBlockInfo* object to apply the required merge condition:

```
// find the SubTextPart
SubTextPart mergeBlock = textControl1.SubTextParts.GetItem("txmb_location");

// create a new MergeBlockInfo object from SubTextPart
TXTextControl.DocumentServer.DataSources.MergeBlockInfo mbInfo =
  new TXTextControl.DocumentServer.DataSources.MergeBlockInfo(mergeBlock);

// add a condition:
// render block, if "id" from parent is greater than 1
mbInfo.BlockMergingCondition.Add(
  new TXTextControl.DocumentServer.DataShaping.FilterInstruction(
    "id",
    TXTextControl.DocumentServer.DataShaping.RelationalOperator.GreaterThan,
    1));

// apply conditions
mbInfo.Apply();
```

When the template is merged using *MailMerge*, you can see that the first inner merge block is not merged while the other 2 blocks are merged as they match the condition (*id*  > 1):

![Merge Blocks](https://s1-www.textcontrol.com/assets/dist/blog/2020/11/17/a/assets/merge.webp "Merge Blocks")

Stay tuned for more improvements and new features of TX Text Control X19!

---

## 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)

---

## Series

- [X19 Sneak Peek: Table of Contents](https://www.textcontrol.com/blog/2020/10/15/x19-sneak-peek-table-of-contents/llms.txt)
- [X19 Sneak Peek: Embedded Files in Adobe PDF Documents](https://www.textcontrol.com/blog/2020/10/16/x19-sneak-peek-embedded-files-in-pdf/llms.txt)
- [X19 Sneak Peek: Integrated Barcode Support](https://www.textcontrol.com/blog/2020/10/19/x19-sneak-peek-integrated-barcode-support/llms.txt)
- [X19 Sneak Peek: Processing AcroForm Fields in Adobe PDF Documents](https://www.textcontrol.com/blog/2020/10/29/sneak-peek-processing-acroform-fields-from-adobe-pdf-documents/llms.txt)
- [X19 Sneak Peek: Storing Document Revisions in PDF/A-3b](https://www.textcontrol.com/blog/2020/11/03/x19-sneak-peek-saving-document-versions-in-pdfa-3b/llms.txt)
- [X19 Sneak Peek: Validating ZUGFeRD / Factur-X Invoices with TX Text Control](https://www.textcontrol.com/blog/2020/11/10/x19-sneak-peek-validating-zugferd-factur-x-invoices-with-tx-text-control/llms.txt)
- [X19 Sneak Peek: Changes for Keyboard Layout and Spell Checking](https://www.textcontrol.com/blog/2020/11/12/x19-sneak-peek-changes-for-keyboard-layout-and-spell-checking/llms.txt)
- **X19 Sneak Peek: Manipulating MergeBlockInfo Objects** (this article)

---

## Related Posts

- [TX Text Control 34.0 SP2 is Now Available: What's New in the Latest Version](https://www.textcontrol.com/blog/2026/02/18/tx-text-control-34-0-sp2-is-now-available/llms.txt)
- [TX Text Control 34.0 SP1 is Now Available: What's New in the Latest Version](https://www.textcontrol.com/blog/2025/12/03/tx-text-control-34-0-sp1-is-now-available/llms.txt)
- [Introducing TX Text Control 34.0: Your Next Leap in Document Processing](https://www.textcontrol.com/blog/2025/11/10/introducing-tx-text-control-34-0-your-next-leap-in-document-processing/llms.txt)
- [Sneak Peek: TX Text Control 34.0 Coming November 2025](https://www.textcontrol.com/blog/2025/10/02/sneak-peek-tx-text-control-34-0-coming-november-2025/llms.txt)
- [TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version](https://www.textcontrol.com/blog/2025/08/14/tx-text-control-33-0-sp3-is-now-available/llms.txt)
- [TX Text Control 33.0 SP2 is Now Available: What's New in the Latest Version](https://www.textcontrol.com/blog/2025/06/18/tx-text-control-33-0-sp2-is-now-available/llms.txt)
- [Service Pack Releases: What's New in TX Text Control 33.0 SP1 and 32.0 SP5](https://www.textcontrol.com/blog/2025/05/07/service-pack-releases-whats-new-in-tx-text-control-33-0-sp1-and-32-0-sp5/llms.txt)
- [The Wait is Over: TX Text Control for Linux is Officially Here](https://www.textcontrol.com/blog/2025/03/12/the-wait-is-over-tx-text-control-for-linux-is-officially-here/llms.txt)
- [Full .NET 9 Support in Text Control .NET Components for ASP.NET Core, Windows Forms, and WPF](https://www.textcontrol.com/blog/2024/11/11/full-net-9-support-in-text-control-net-components-for-asp-net-core-windows-forms-and-wpf/llms.txt)
- [TX Text Control 32.0 Service Pack 4 Released](https://www.textcontrol.com/blog/2024/09/02/tx-text-control-32-0-service-pack-4-released/llms.txt)
- [Service Pack 3: MailMerge Supports SVG Images](https://www.textcontrol.com/blog/2024/04/29/service-pack-3-mailmerge-supports-svg-images/llms.txt)
- [TX Text Control 32.0 Service Pack 3 Released](https://www.textcontrol.com/blog/2024/04/29/tx-text-control-32-0-service-pack-3-released/llms.txt)
- [32.0 Service Pack 2: Licensing, Unit Testing, and Azure DevOps](https://www.textcontrol.com/blog/2024/01/05/32-0-service-pack-2-licensing-unit-testing-and-azure-devops/llms.txt)
- [Service Pack 1 for TX Text Control 32.0 Released](https://www.textcontrol.com/blog/2023/11/22/service-pack-1-for-tx-text-control-32-released/llms.txt)
- [Service Pack 4 for TX Text Control 31.0 Released](https://www.textcontrol.com/blog/2023/09/19/service-pack-4-for-tx-text-control-31-released/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)
- [Sneak Peek 32.0: Modifying the Normal Stylesheet](https://www.textcontrol.com/blog/2023/07/04/sneak-peek-320-modifying-the-normal-stylesheet/llms.txt)
- [Sneak Peek 32.0: Introducing Footnotes](https://www.textcontrol.com/blog/2023/06/23/sneak-peek-320-introducing-footnotes/llms.txt)
- [Service Pack 3 for TX Text Control 31.0 Released](https://www.textcontrol.com/blog/2023/06/22/service-pack-3-for-tx-text-control-31-released/llms.txt)
- [Service Pack 2 for TX Text Control 31.0 Released](https://www.textcontrol.com/blog/2023/02/22/service-pack-2-for-tx-text-control-31-released/llms.txt)
- [Service Pack 1 for TX Text Control 31.0 Released](https://www.textcontrol.com/blog/2022/12/16/service-pack-1-for-tx-text-control-31-released/llms.txt)
- [Service Pack 3 for TX Text Control 30.0 Released](https://www.textcontrol.com/blog/2022/09/20/service-pack-3-for-tx-text-control-30-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)
- [Visual Studio 2022 and .NET 5, 6 and 7 (Preview) Support and Strategy](https://www.textcontrol.com/blog/2022/08/11/visual-studio-2022-net-5-6-7-support-and-strategy/llms.txt)
- [MailMerge: Merging Hyperlinks using the FieldMerged Event](https://www.textcontrol.com/blog/2022/06/08/mailmerge-merging-hyperlinks-using-the-fieldmerged-event/llms.txt)
