Related data
Resolve prefixed field names
Merge the hierarchical data and see fields inside a repeating block retrieve values from related parent and child objects.
Related objectsResolve explicit field paths
Prefixes and dot notation reach beyond the current block record.
Dot notationContextCurrent row
PathPrefixed field
HierarchyPreserved JSON
ResolutionDuring merge
Template structureUnderstand the current template
Explore its merge fields, repeating blocks, and nested structure in an interactive template map.
Inspector
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Address fields beyond the current object
Inside nested reporting structures, a simple field name resolves against the current data row. Prefixes and dot notation make the relationship explicit when a field must address a related object.
For example, a product field can be represented as Product.Name while the surrounding block iterates order-item objects.
API used
MailMerge.MergeJsonData
Key members
The JSON hierarchy remains intact so prefixed field names and dot notation can resolve values across related objects.
using var textControl = new ServerTextControl();
textControl.Create();
using var mailMerge = new MailMerge
{
TextComponent = textControl,
RemoveEmptyBlocks = true
};
mailMerge.LoadTemplate(templatePath, FileFormat.InternalUnicodeFormat);
mailMerge.MergeJsonData(File.ReadAllText(dataPath));
mailMerge.SaveDocumentToMemory(
out byte[] document,
BinaryStreamType.InternalUnicodeFormat,
new SaveSettings());
How it works
MergeJsonData preserves the JSON hierarchy. MailMerge interprets the prefix path stored in the field name and resolves each segment relative to the current block record.
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
Displays supported document and PDF formats in the browser.
dotnet add package TXTextControl.Web.DocumentViewer --version 34.2.0