TX Sheet Control

Mail Merge

Topic

One template, one invoice for each customer: mail merge combines a reusable workbook template with JSON records, such as a customer and its line items. What follows covers how a merge works on each platform, how to design templates that hold up with real data and how to build a complete pipeline from the template to a delivered PDF.

The examples use the invoice of the Sample Documents: a template, its JSON record, the merged XLSX and the PDF.

How Mail Merge Works

A merge brings a template, a record and a merge operation together:

  • The template is a workbook with values, formulas, styles, print settings and declarative bindings. You design it on the Reporting tab of the browser editor or define its bindings in code, and save it as TXWB to retain them.
  • The record is JSON data that your application validates and authorizes. A fixed binding writes a single value, such as customer.name, into a cell. A repeat block expands a band of template rows for each element of an array, such as items.
  • The merge fills the template. Formula cells calculate the amounts and totals after the expansion, and the merge returns diagnostics: warnings, formula errors and repeated ranges.

The merge runs in the browser editor with a captured template, or without a browser in the server packages @txtextcontrol/tx-sheet-control-server for Node.js and TXTextControl.TXSheetControl.Server for .NET. Every unrelated merge starts from a clean copy of the template, never from a document that is already expanded.

Find the Right Page

If you want toRead
Inspect the bindings of a template in the editorMail Merge With JSON
Define bindings in code and merge a record in the browser, Node.js or .NETMail Merge With JSON
Choose safe binding paths, data types and policies for missing and null valuesMerge Policies and Template Design
Design repeat bands, persist templates in TXWB and process batches of invoicesMerge Policies and Template Design
Follow an invoice from the template and the data to a checked and delivered PDFInvoice Report Pipeline
Fix blank fields, duplicate rows or wrong totalsMail Merge in Troubleshooting

Where to Start

  1. Sample Documents: download the invoice template and its data.
  2. Mail Merge With JSON: merge the invoice on the platform you use.
  3. Merge Policies and Template Design: make your own templates work with real data.
  4. Invoice Report Pipeline: put validation, merge, export and delivery together.

Pages in This Section

  • Mail Merge With JSON: inspect a field in the invoice template, define bindings and repeat blocks and merge in the browser, Node.js and .NET.
  • Merge Policies and Template Design: safe paths and types, missing-data policies, repeat bands, persistence and batches.
  • Invoice Report Pipeline: the five steps from authoring the template to delivering the PDF and releasing the processing owners.