# Invoice Report Pipeline

> Build an invoice report pipeline: author a TXWB template, validate data, merge a clean copy in .NET, Node.js or the browser, check the total and deliver a PDF.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Sheet Control > Mail Merge > Invoice Report Pipeline
- **829 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/llms-full.txt

---

From a clean template to a delivered invoice, a repeatable report pipeline supplies authorized application data, validates the result and exports it with predictable fonts and print settings. The browser editor can author the template, and the independent server packages can generate the documents without a browser.

### How the Pipeline Runs

The pipeline has five steps, in this order:

1. [Author the template](#author-the-template) and save it as TXWB.
2. [Prepare the data](#prepare-the-data): validate and authorize the record.
3. [Merge a clean copy](#merge-a-clean-copy) of the template.
4. [Check and export](#check-and-export) the merged invoice.
5. [Deliver and release](#deliver-and-release) the output and the processing owners.

### Author the Template

Use the [invoice template sample](https://docs.textcontrol.com/assets/img/tx-sheet-control/invoice-template.85b233b6.txwb) as an example. It has:

- a fixed customer name,
- a repeating line-item band,
- row formulas,
- a total below the band.

The original coordinates identify the bindings before expansion. Save the template as TXWB to retain the merge definition.

### Prepare the Data

Before merging, validate:

- amounts as numbers,
- arrays as arrays,
- required names and IDs.

Choose the policies for missing fields, null values and empty arrays intentionally, as described in [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt). Application authorization decides which customer and line items the request may use. Credentials and data retrieval do not belong in the template.

### Merge a Clean Copy

Each platform merges a clean copy of the original template:

| Platform | How you merge |
|---|---|
| .NET | Load the original TXWB into a request or job owner and await [`Workbook.MergeAsync(record)`](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/mergeasync-method/llms-full.txt). |
| Node.js | Load it into [`ServerSheetControl`](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/serversheetcontrol/llms-full.txt) and await the public merge operation. |
| Browser | [`createMailMergeTemplate()`](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/workbook/createmailmergetemplate-method/llms-full.txt) captures a reusable starting point and produces independent merge results. |

[Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt) shows the mail-merge examples for each platform.

> Warning
>
> **Merge Into a Clean Copy.** Do not merge repeatedly into a document that is already expanded.

Isolate customers that you process concurrently. Reusing a warm processing pool can help, but each job still needs a clean, independent document state.

### Check and Export

Inspect the warnings, the formula errors, the repeated ranges and the invoice total. The sample data produces 3 × 120 plus 2 × 90, or 540. Review the [merged XLSX](https://docs.textcontrol.com/assets/img/tx-sheet-control/invoice-merged.debe2389.xlsx) and the [PDF](https://docs.textcontrol.com/assets/img/tx-sheet-control/invoice.2af1f489.pdf) of the sample.

Configure the print area, paper, margins and fit-to-width so that the amount column stays on the intended page. [Page Layout and Print Settings](https://docs.textcontrol.com/tx-sheet-control/pdf/page-layout/llms-full.txt) describes these settings.

### Deliver and Release

- **Await the export** before you send a successful response.
- **Return a correct content type and file name,** and authorize storage and downloads.
- **Release the processing owners** in `finally` or with `using`.
- **Record useful timings and warning summaries** without logging customer data or license strings.

Evaluation PDFs retain their watermark.

### Next Steps

- [Backend Services](https://docs.textcontrol.com/tx-sheet-control/document-processing/backend-services/llms-full.txt): return the PDF bytes from an ASP.NET Core or Node.js request.
- [Font Handling](https://docs.textcontrol.com/tx-sheet-control/deployment/fonts/llms-full.txt): use the same font faces in browser and backend output.
- [Measuring Performance](https://docs.textcontrol.com/tx-sheet-control/document-processing/performance/llms-full.txt): measure the complete workflow, from loading to export.

---

## Nearby

- **Previous:** [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt)
- **Next:** [Document Processing](https://docs.textcontrol.com/tx-sheet-control/document-processing/llms-full.txt)
