Form-field mail merge
Prepare a patient form
Compare an editable, pre-populated form with a flattened record generated from the same template and JSON.
Two-stage workflowMerge, review, and export
First choose how fields are merged, then download the prepared result.
JSON + form
- 1
Select the output behavior
Keep fields interactive for completion, or replace them with permanent content.
- 2
Export the prepared result
After reviewing the loaded result, download it as an Adobe PDF.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Choose how merged values affect form fields
Mail merge can target form fields without requiring separate field-by-field manipulation. The merge mode determines whether recipients can still edit the result.
Preselect keeps the controls and sets their current values. Replace removes the controls and writes ordinary document content in their place.
API used
MailMerge.FormFieldMergeType
Key members
The same template and JSON source produce two different deliverables by changing only FormFieldMergeType.
using var mailMerge = new MailMerge
{
TextComponent = textControl,
FormFieldMergeType = replace
? FormFieldMergeType.Replace
: FormFieldMergeType.Preselect,
RemoveEmptyBlocks = false
};
mailMerge.MergeJsonData(jsonData);
How it works
The controller loads the patient-history template and the colocated JSON data. FormFieldMergeType.Preselect preserves fields; FormFieldMergeType.Replace flattens the merged values before the result is loaded.
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