How fields and data work
A template is a Word document with places for data. This guide explains how those places read your data: single values, lists, related tables, and a whole spreadsheet of rows that becomes a document per row. For the editor's buttons, read Preparing a template. For the calls that send data, read the API guide.
Service agreement
between Northwind Ltd and client.name, signed on date.
| Service | Price |
|---|---|
| items[].name | price |
Total: total
Service agreement
between Northwind Ltd and Contoso Logistics S.A., signed on 12 March 2026.
| Service | Price |
|---|---|
| Fleet tracking | 2,400.00 |
| Route planning | 1,200.00 |
| Support | 600.00 |
Total: 4,200.00 EUR
In the editor, a green field reads one value, a purple field reads an item of a list (it repeats), and an orange field reads a row of a series (each copy of the document gets another row).
Fields and markers #
There are two ways to put a value into the text:
- A data field. Choose Insert data and click a value, or select text and choose Turn into a field. The field is a Word content control, so it survives editing in Word and saving as DOCX. Click it to change its path, its format or its text when there is no data.
- A marker. Type
{{client.name}}anywhere in the text, also in Word before you import the file. The value takes the formatting of the marker's first character. A marker may take a format after its path:{{total \# "#,##0.00"}}.
Both read a path: where the value is in your data. A path starts with
the name of a data source and goes down the data with dots, and with
[0], [1] for the items of a list:
| Path | Reads |
|---|---|
client.name | name inside client of the main JSON data (json.dane1) |
json.offer.client.name | The same in a JSON source named offer |
json.dane1.items[0].price | The price of the first item |
xlsx.prices.Sheet1.B2 | Cell B2 of the sheet Sheet1 of the Excel source prices |
csv.recipients.rows[0][1] | The second column of the first row of a CSV file (without its header row) |
table.clients.name | The column name of the table clients (see related tables) |
A path without a source (client.name) reads the main JSON data. A plain
JSON object sent to the API is the main data, so client.name reads
{"client": {"name": "…"}}. Values are text: data is never run as code
and never read again as a marker.
Formats and empty values #
London, date \@ "d MMMM yyyy"
To: client.name \* Upper
Amount due: total \# "#,##0.00" EUR
Payment terms: terms (without data: “to be agreed”)
London, 12 March 2026
To: CONTOSO LOGISTICS S.A.
Amount due: 4,200.00 EUR
Payment terms: to be agreed
Click a field to choose how its value is written: dates (short, with the name of the month, with the day of the week, ISO, with the time), numbers (two decimals, an amount, a whole number) and letter case, or Word's own field switches:
| Switch | Example | Gives |
|---|---|---|
\@ date | \@ "d MMMM yyyy" | 12 March 2026 |
\# number | \# "#,##0.00" | 4,200.00 |
\* case | \* Upper (also Lower, FirstCap, Caps) | CONTOSO LOGISTICS S.A. |
\b, \f | \b "Street " | Text before (or after) a value that is not empty |
Send dates as 2026-03-12 (or 2026-03-12T14:05:00Z) and numbers as JSON
numbers. Month and day names follow the field's language (English, Polish,
German).
When there is no data. Without data sets the text a field shows when
the value is missing or empty, e.g. "to be agreed". A value missing
without such a text stops the PDF with an error naming every missing path
at once, so a half-filled document never reaches a customer. Send
"missing": "empty" to the API to leave such values empty instead.
Data sources #
A template can read several data sources at once, each with its own name:
- JSON: objects and lists of any depth. Also XML (an ERP export or a Polish KSeF e-invoice), read as JSON.
- Excel (
.xlsx, also.ods): cells by address (Sheet1.B2), or a sheet or a named Excel table as a list of rows with the column names as keys. - CSV: in UTF-8, UTF-16 or the encodings of a Polish Excel, with a comma, semicolon or tab between columns.
Add sources in Data in the toolbar. The template keeps them as sample
data, so the preview shows a filled document while you work. Data sent to
the API replaces them. GET /api/templates/{id}/schema lists every path
the template reads and gives an example data file that fills all of them.
Repeated rows and paragraphs #
Invoice 2026/03/017
↻ one row per item of items| Product | Qty | Amount |
|---|---|---|
| items[].product | qty | amount |
| Total | =SUM(ABOVE) |
Invoice 2026/03/017
| Product | Qty | Amount |
|---|---|---|
| Fleet tracking | 2 | 2,400.00 |
| Route planning | 1 | 1,200.00 |
| Support (months) | 12 | 600.00 |
| Total | 4,200.00 |
A table row with a field of a list item (items[].product) repeats once
for each item of items. Choose Repeat row… to set it up, also for an
Excel sheet or CSV rows. The header and the rows after it (a total, for
example) stay as they are. With no items, only the repeated row goes away.
A header row marked as such in Word repeats on every page.
Word's formula fields work on the filled table: =SUM(ABOVE) under the
repeated rows adds up the rows the data gave. A field of a list item in an
ordinary paragraph (not in a table) repeats the paragraph: a list of names,
for example.
Repeated sections and nested lists #
Quarterly statement
clients[].name
| Service | Amount |
|---|---|
| clients[].items[].service | amount |
Quarterly statement
Contoso Logistics S.A.
| Service | Amount |
|---|---|
| Fleet tracking | 2,400.00 |
| Route planning | 1,200.00 |
Fabrikam Retail
| Service | Amount |
|---|---|
| Support | 600.00 |
Select paragraphs and tables and choose Repeat for each item…: the
whole part repeats for each item, e.g. a heading and a table for each
client. Inside it, a repeated row can read a list of the current item
(clients[].items), so every client gets their own items. In Word the part
is a repeating section content control.
Conditions #
Dear client.name,
thank you for your order.
You get a loyalty discount of discount%.
Kind regards, Northwind Ltd
Dear Contoso Logistics S.A.,
thank you for your order.
You get a loyalty discount of 10%.
Kind regards, Northwind Ltd
Dear Fabrikam Retail,
thank you for your order.
Kind regards, Northwind Ltd
Select paragraphs, or put the caret in a table row or table, and choose
Show when…. The block stays in the PDF only when the value is filled
in, is empty, equals, differs from, or is greater or less than a value you
give. Numbers compare as numbers, everything else as text. A missing value
is empty, and so are false, null and empty lists. Word shows the block
always; only the PDF leaves it out.
Related tables #
| id | name |
|---|---|
| C1 | Contoso Logistics S.A. |
| C2 | Fabrikam Retail |
| order | clientId | product |
|---|---|---|
| O-101 | C1 | Fleet tracking |
| O-102 | C2 | Support |
| O-103 | C1 | Route planning |
Orders of table.clients.name
↻ only the orders of this client| Order | Product |
|---|---|
| table.orders[].order | product |
Orders of Contoso Logistics S.A.
| Order | Product |
|---|---|
| O-101 | Fleet tracking |
| O-103 | Route planning |
Orders of Fabrikam Retail
| Order | Product |
|---|---|
| O-102 | Support |
Data often comes as tables that point to each other, like a database:
clients, their orders, the lines of each order. Oomplo reads every list of
objects, Excel sheet and CSV file as a table and finds its key (a
column with a different value in every row, such as id) and the
links between tables (a column clientId whose values are ids of
clients). The Tables section of Document data shows them with
the number of rows, the key and an arrow such as → clients at the
linking column.
- A field reads a column:
table.clients.name. - A repeated row or section reads a table:
table.orders[].product. It shows only the rows linked to the current row, so a client's document shows that client's orders, and inside each order its own lines. - Documents above the tables chooses one document or one for each row of the table (for example one for each client). Each document then shows its row (the current row), the rows it points to (one per document: the client of an order) and the rows that point to it (related rows only).
- A field can also pick one row by its key, whatever document it is in:
table.products[code="P-12"].price.
You do not have to join the data in your system first. Through the API, a
series job can also join two Excel sheets by a key, e.g. invoices and their
lines (series.join, see the API guide).
Pictures, check boxes and codes #
- Pictures: a picture frame bound to a path shows the PNG or JPEG of
the data (
data:image/png;base64,…or plain base64), as large as fits. In a repeated row, each item gets its own picture. - Check boxes: a field marked as a check box shows ☒ for a true value
(
true, a number other than 0, text other than empty,0,false,no) and ☐ otherwise. - QR codes and barcodes: QR, Code 128 and EAN-13 with a value from the data, for example a payment link or a parcel number.
Many documents from one template #
| name | title | city |
|---|---|---|
| Anna Nowak | Ms | Kraków |
| John Smith | Mr | Leeds |
| Maria Rossi | Ms | Milan |
recipient.name
recipient.city
Dear recipient.title recipient.name,
our new price list starts on 1 April 2026…
Copy name: {{json.recipient.name}}- Anna Nowak.pdf
- John Smith.pdf
- Maria Rossi.pdf
- Anna Nowak
- John Smith
- Maria Rossi
- each copy from a new page, its own page numbers
A series makes one copy of the template for each row of a spreadsheet,
CSV file or JSON list. The row is the data of its copy: with a series named
recipient, the fields read json.recipient.name, json.recipient.city
and so on, with the column names as keys. Fields outside the series are the
same in every copy. A Word mail-merge template becomes such a template on
import.
In the editor, Generate from a file (or Download PDF in a template with a series) offers:
- the visible row only;
- one PDF to print: copy after copy, each from a new page with its own page numbers, and a PDF bookmark for each copy with its headings under it; two-sided printing starts each copy on an odd page;
- a ZIP file with a separate PDF for each row.
Rows picks part of the series (1-3, 7; empty: all), and Copy
name is a pattern for the bookmarks and file names, e.g.
{{json.recipient.name}}. The window lists the copies and names a wrong
row or a missing field before anything is made. A series has up to 1000
rows and 10,000 pages in one PDF.
The same through the API is a series job (POST /api/templates/{id}/jobs,
see the API guide): Oomplo first fills the
template with every row and answers with the failing rows before making
anything, then makes the documents in the background and tells your
webhook when they are ready. On the command line:
oomplo pdf letter.docx --series recipient=recipients.xlsx --label "{{json.recipient.name}}" --zip --out letters.zip.