DoConure

Writing a template

A template is your normal document with placeholders where the data goes. You write it in the program you already use - Word for a DOCX, any editor for an HTML file, Excel for an XLSX - and upload it; every generation fills it in with the JSON of that call. One rule to remember:

Placeholders mirror the structure of the JSON. If the JSON has customer.name, the document says {{ customer.name }}. That is all.

Fields and objects

The JSON you send

{
  "number": "2026-000147",
  "customer": {
    "name": "Acme Srl",
    "city": "Milan"
  }
}

What you write in the document

Invoice no. {{ number }}

Customer: {{ customer.name }}
City:     {{ customer.city }}

A field at the root of the JSON is written with its bare name; a field inside an object is reached with a dot, nested as deep as you need ({{ customer.address.city }}). The same placeholder may appear more than once in a document.

Writing one, start to finish

  1. Start from the document you already send - an invoice, a contract, a letter - laid out exactly as it should look.
  2. Replace each variable part with a placeholder named after its field in the JSON. In Word, type each placeholder in one go: editing it in the middle splits it invisibly (Common mistakes).
  3. Repeat a row per item of a list with a loop (Lists and repeating rows), and show a part only when it applies with a condition (Conditional parts).
  4. Tick checkboxes, place pictures and charts from the data: checkboxes below, pictures and charts in Making a value fit.
  5. Mark where each signer signs if the document will be signed: signature tags below.
  6. Upload it, then Validate and Preview in the console: Validate compares a sample JSON with what the file asks for, and Preview shows the finished PDF, watermarked. Neither costs credit.

In Word, in HTML, in Excel

FormatWhere the placeholders go
Word (DOCX)In the text and in table cells; loops and conditions as in the pages linked above. Fields and checkboxes are filled in the header and footer too (a reference number, a date); keep repeating rows and conditional blocks in the body.
HTMLIn the markup, anywhere text goes; loops and conditions are ordinary {% for %} and {% if %} blocks around the elements they repeat or hide.
Excel (XLSX)In cells; loops and conditions work on whole rows.

Which format suits which document, and what each can do: What each format can do.

Bold, fonts and layout come from the template

A value arrives as plain text and takes the look of the place it lands in. All formatting is written in the template itself:

  • Word: format the placeholder. Make {{ customer.name }} bold, or give it a font, a size or a colour, and the value comes out that way. Format the whole placeholder, braces included, the same way.
  • HTML: your markup and CSS, for example <strong>{{ customer.name }}</strong>. A value is always printed as text: if the data contains <b>, the document shows those characters, it does not turn bold.
  • Excel: the cell's own format (font, fill, number format).

There is nothing to write in the JSON to make a value bold, and no formatting code for it. **words** in a value is printed as it is, asterisks included: the double asterisks are understood only in the message of a signature request mail (Writing the message), never in a document. Numbers and dates are printed as received: send them already formatted (Making a value fit the space you left for it).

Where a signer signs

A document that will be signed says where, with a tag written the same way: {{ signature.A }} places the signature of the signer whose key is A in the request's signers; {{ signature.A.name }} and {{ signature.A.date }} place their name and the date. The tag prints nothing and is removed from the finished PDF. Sizes, the rules and the alternative with coordinates: Where the signature goes on the page.

Ticking a checkbox (Word)

A checkbox in a Word template is set by a true or false of the same name in the data:

"data": { "consenso": true, "newsletter": false }
  • Name the checkbox: a legacy form checkbox (Developer → Legacy tools) by its bookmark, in its properties; a check box content control (Developer → Check box) by its Tag, or else its Title. Upper and lower case do not matter.
  • true ticks it, false clears it.
  • No key, or null: the box stays exactly as it is in the template.
  • Anything else ("yes", 1) is not guessed at: the box stays as it is, and the answer's warnings say a checkbox value was not true or false.

The template's page in the console lists the checkboxes it found beside its fields, so you can see which names the data may set; a signature tag ({{ signature.A }}) is not listed as data to send, because it is where a signer signs, not a value.

Only names at the root of the data are read. In an HTML template you write the box yourself, for example {{ '☒' if consenso else '☐' }}.

Managing templates from a script: Managing templates from a script. Repeating rows: Lists and repeating rows. If/else: Conditional parts. Sizing a value to the space you left for it: Making a value fit the space you left for it. Symptom-first troubleshooting: Common mistakes. The PDF is made with free fonts: which fonts keep your Word layout.