Value formatting
Format raw numeric values
Merge the report to turn plain JSON numbers into template-defined currency and decimal representations.
Typed valuesApply template number formats
Raw numbers remain reusable while merge fields control their presentation.
en-USJSON valueNumeric
Source cultureInvariant
Output cultureen-US
FormatMerge field
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
Keep values typed and presentation flexible
The JSON contains numbers such as 249.56, not preformatted strings. Numeric format switches stored in merge fields control currency symbols, decimal digits, and separators in the generated document.
The controller sets explicit source and output cultures so the result remains deterministic regardless of the server's regional settings.
API used
MailMerge.MergeCulture
Key members
Separate source and output cultures keep raw JSON numbers typed while template format switches produce deterministic text.
using var mailMerge = new MailMerge
{
TextComponent = textControl,
RemoveEmptyBlocks = true,
DataSourceCulture = CultureInfo.InvariantCulture,
MergeCulture = CultureInfo.GetCultureInfo("en-US")
};
mailMerge.MergeJsonData(File.ReadAllText(dataPath));
How it works
MergeJsonData preserves numeric values. MailMerge applies the format encoded by each field using the configured en-US output culture before saving the document.
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