Interactive designer
Build a nested data table
Select a parent data block, include its child blocks, and decide which fields each table level displays.
JSON hierarchy detectedSchema-aware
The designer reads object relationships and arrays from the sample JSON, then turns them into selectable merge-block levels.
-
1
Design the hierarchy
Create a table whose nested merge blocks follow the JSON relationships.
-
2
Preview the merged result
Merge all invoice records or return to the editable template.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Nested blocks mirror nested data
A merge block repeats once for each record in its data table. A child block belongs inside its parent block and repeats only for the child records of the current parent row.
Key members
Create a block hierarchy
DataSourceManager.InsertMergeBlock
Merge nested data
MailMerge.MergeJsonData
Build the interactive preview
data-block-preview
How the hierarchy is stored
TX Text Control represents a reporting block as a subtextpart whose name starts with txmb_. The controller creates a recursive MergeBlockInfo tree: every item in ChildBlocks becomes a smaller subtextpart inside its parent. The selected ColumnNames become merge fields at that level, so parent fields remain outside their child blocks.
How the sample JSON maps to blocks
Sales_SalesOrderDetail is the outer repeating order-detail table. Its Production_Product object can be inserted as a nested block, and Production_ProductProductPhoto can form a third level. During the merge, each inner block is evaluated in the context of its current parent record.
var manager = new DataSourceManager();
manager.LoadJson(json);
manager.InsertMergeBlock(
textControl,
CreateMergeBlockInfo(design),
new MergeBlockSettings(BlockTemplateType.TableRow, true));
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0