Fork me on GitHub

WRITE YOUR TEMPLATE

Small markers.
Flexible documents.

Type these markers into your Word document. They use the fields inside your request's data object. Keep your styles, tables and images; let the template decide which content belongs in the result.

Fields and nested data

Read object members and list items. The data prefix is optional unless you need to refer explicitly to the root object.

Dear {customer.name},
Reference: {orders[0].reference}
City: {data["billing-address"]["city name"]}

Insert strings, numbers or booleans. An explicit null prints nothing; an object or list needs further selection or conversion.

If, else and inline conditions

Include a section, a paragraph or just a few words in the middle of a sentence. The else branch is optional.

This is {#if draft}a draft{#else}final{/if}.
{#if total >= 1000 && approved}
Additional review completed.
{/if}

Conditions must return a real boolean. A string is not automatically true because it contains text. For “else if”, nest another #if inside #else.

For each item

The for-loop syntax is #each. Give the current item an alias and repeat content for every element of a list.

{#each orders as order}
{loop.number}. {order.reference}
{/each}

An empty list produces nothing. loop provides index, number, size, first and last. DOCX also supports structural repetition of supported paragraphs and table rows.

Null, missing and string checks

Use ?? to supply an explicit fallback for missing or null fields. Empty strings remain empty unless you test them.

{customer.nickname ?? customer.name ?? "Guest"}
{#if (name ?? null) == null}No name supplied{/if}
{#if trim(name ?? "") == ""}Name is blank{/if}
{#if contains(note ?? "", "review", true)}Review requested{/if}

Built-ins: contains, startsWith, endsWith, trim and equalsIgnoreCase. The optional third boolean on substring/prefix/suffix checks enables case-insensitive matching. A direct name == null check requires the field to exist.

Format and chain value pipes

A pipe transforms a value before insertion. Built-in number and date formatting uses the generation's explicit locale and time zone.

{total | number("#,##0.00")}
{issuedOn | date("dd-MM-uuuu")}
{customer | select("balance") | number("0.00")}

select illustrates a custom value pipe, not a built-in: an operator must install it first. Registered pipes can accept arguments and return values for the next stage. Every stage needs parentheses. See the date and time reference and template error guide. Pipes go on placeholders, not inside #if or #each expressions.

Insert an image

The DOCX generator's built-in content pipe turns a Base64 PNG or JPEG value into an inline image, for both DOCX and PDF generation.

{company.logo | image(40, 20, true)}
{optionalPhoto ?? null | image(25, 35, true)}

The first two arguments are maximum width and height in millimetres; true preserves the aspect ratio without upscaling. Defaults are image(50, 50, true). Null inserts nothing. Supply plain padded Base64, not a URL or data URI. Content pipes cannot be chained before or after any other pipe.

Check marks, crosses and boxes

The checkbox content pipe receives a Boolean. Expressions are evaluated before the pipe; use an explicit fallback for null or missing values.

{accepted | checkbox()}
{(gender == "Vrouw") | checkbox()}
{accepted ?? false | checkbox(true, "check", "cross")}
{accepted ?? false | checkbox(false, "check", "empty")}

The first argument chooses whether to draw a box. The next two select the true and false marks: "check", "cross" or "empty". Defaults draw a boxed check for true and an empty box for false. Vector geometry follows the surrounding size and bold styling, so no checkbox-symbol font is required. See the qualified checkbox profile ↗.

Yes, you can nest them

Put an if inside a loop, a loop inside an if, or another loop inside that loop. Use different aliases to keep outer items accessible.

In this example, only active projects appear. Only included tasks appear, and each task can conditionally show a review note. The inner loop.number belongs to the task list; after that loop, the enclosing loop is restored.

Each block must close with its matching {/if} or {/each}. Processing depth, repetitions and output remain bounded.

Nested Word template markers
{#each projects as project}
{#if project.active}
Project: {project.name}
{#each project.tasks as task}
{#if task.include}
{loop.number}. {task.name} — {project.name}
{#if contains(task.note ?? "", "review", true)}
Review requested: {task.note}
{/if}
{/if}
{/each}
{/if}
{/each}

Dates and times, explained

Use {issuedOn | date("dd-MM-yyyy")} to turn 2026-10-28 into 28-10-2026. Patterns are case-sensitive: MM means month; mm means minutes. The generation's locale controls names and abbreviations; the time zone controls timestamp conversion.

Common date and time patterns, with Dutch examples
PatternMeaningExample
d / ddDay of the month, without / with leading zero8 / 08
M / MMMonth number, without / with leading zero3 / 03
MMM / MMMMShort / full month namemrt. / maart
EEE / EEEEShort / full weekday namewo / woensdag
yyyy / uuuuYear of era / continuous calendar year2026 / 2026
yyLast two digits of the year26
HH / hhHour, 00–23 / 01–1214 / 02
aAM/PM marker for a 12-hour clockp.m.
mm / ssMinutes / seconds05 / 09
SSSThree fractional-second digits123
XXXTime-zone offset; UTC prints Z+01:00
VV / zTime-zone identifier / short zone nameEurope/Amsterdam / CET
DDay of the year301
Q / QQQQuarter number / short quarter label4 / K4
w / YYYYLocale-dependent week number / week-based yearMay differ from calendar year near New Year

yyyy or uuuu?

yyyy is supported. For modern business dates it produces the same output as uuuu. Technically, yyyy is the year within an era, whereas uuuu is a continuous year that also represents year zero and negative years. We recommend uuuu for precision, not as a requirement. Avoid uppercase YYYY for ordinary dates: it describes the week-based year and can differ around New Year.

Copy an example

Date and timestamp patterns
{issuedOn | date("dd-MM-yyyy")}
{issuedOn | date("d MMMM uuuu")}
{issuedOn | date("EEEE d MMMM uuuu")}
{createdAt | date("dd-MM-uuuu 'om' HH:mm")}
{createdAt | date("uuuu-MM-dd'T'HH:mm:ssXXX")}

With locale nl-NL, 2026-10-28 becomes woensdag 28 oktober 2026 using the third pattern. Names and punctuation can differ by locale. Single quotes inside the pattern mark literal text such as 'om' or 'T'; two consecutive single quotes produce a literal apostrophe.

Input, locale and time zone

Supply a string containing an ISO date, such as 2026-10-28, or a timestamp with an explicit offset, such as 2026-10-28T14:05:00Z or 2026-10-28T15:05:00+01:00. A timestamp without an offset, such as 2026-10-28T14:05:00, is rejected. A date has no clock or zone fields, so do not ask it for HH:mm or XXX.

Set options.locale to a language tag such as nl-NL or en-US, and options.timeZone to a zone such as Europe/Amsterdam. Defaults are the locale-neutral root locale and UTC, never the server's local settings. Timestamp conversion includes daylight-saving rules and can change the calendar date. Date-only values remain dates. Patterns are limited to 64 characters; null prints empty text, while a missing field needs an explicit fallback.

The engine uses Java 17 DateTimeFormatter patterns. See the complete pattern reference for stand-alone month names, eras, quarters, week fields, optional sections and zone formats. These describe output formatting, not alternative input formats.

Find a template error

From alpha.4, the Playground diagnostic PDF marks the first locatable parser error in a literal copy of your template and appends an explanation. The original generation remains unsuccessful; correct the Word file and try again.

On released 0.5.0-alpha.7, the Playground uses development diagnostics by default. Curl receives the same details from the same server. A production-mode service deliberately returns less detail. Search the container logs for GENERATION_REJECTED and the response's X-Request-ID. Use curl --fail-with-body to retain an HTTP error's JSON body.

template:8 means offset 8, counted from zero in the local text fragment: roughly the ninth character, possibly the end of the expression. It is not a Word page, line or document-wide character position. An xml:line:column location refers to a parser position in the named package part.

Available from 0.3.0-alpha.3: expressions accept straight double/single quotes and typographic quotes, including mixed opening and closing forms. The parser reads quotes in context; ordinary document text and inserted values stay unchanged. At a possible closing quote, expression punctuation determines the boundary. Escape an interior quote when it would otherwise be read as the end of the string.

{issuedOn | date("dd-MM-yyyy")}
{issuedOn | date('dd-MM-yyyy')}
{issuedOn | date(“dd-MM-yyyy”)}
{issuedOn | date(‘dd-MM-yyyy")}

Version 0.3.0-alpha.3 also adds specific syntax reasons, a bounded expression excerpt with an error marker, and available DOCX part/paragraph context to development responses and logs. Paragraph numbers are one-based within the named part, including tables and text boxes; they are not page numbers. Production responses and logs omit expression excerpts. Development may expose document text, so use synthetic data. This site does not change a running container's behavior.

Formatted text from your data

From 0.3.0-alpha.5, insert a bounded RTF fragment with bold, italic, underline, strikeout, Unicode, explicit fonts/colors and paragraph breaks:

Word template
{description | richText("rtf")}
JSON data
{
  "description": "{\\rtf1\\ansi Plain {\\b bold} and {\\i italic}.\\par Second paragraph.}"
}

Leading and trailing empty paragraphs are trimmed independently by default. The first and last inserted paragraphs join the template text before and after the marker; internal paragraph breaks remain. To require a standalone marker paragraph, use {description | richText("rtf", true, true, false)}. The three booleans are trimStart, trimEnd and inline.

Missing, null or empty values insert nothing. Inserted text stays literal and cannot introduce template instructions. Use one content pipe per marker. RTF images, lists/tables, fields, active content, imported paragraph layout and unsupported controls are rejected. Normal font and PDF-profile requirements still apply. See the complete profile, placement rules, budgets and compatibility guide ↗.

From alpha.5, Word text formatted as hidden in print view does not activate template instructions. Data inserted into the document stays literal: it cannot introduce new template instructions. Write {{ and }} in the template for literal braces. Markers do not automatically normalize whitespace or line breaks; use the DOCX structural rules when adding or removing whole paragraphs/rows. Text watermarks resolve text expressions and value pipes, but cannot contain image/content pipes.

Use the Playground on your own development installation to inspect the selected provider's capabilities and available pipes. This site adds documentation only; it does not send your data or generate documents.