Getting started

The first Word template

Object lists for the lender, loan agreements, condition reports: in Moliri they are produced from Word templates and the objects’ data. In this exercise you write a template that turns every loan in the exhibition into an object sheet with image, dimensions and contract number. It takes about thirty minutes and needs Word and write access to the project Sonderausstellung 2026 in the demo holdings.

1. Look up the field names

Commands in the template address fields by their name, not by the label in the layout. The label may be different: a field Objekttitel can be called Titel in the layout.

  1. In the special exhibition, open an object, layout Leihverkehr.

  2. For every field that should go on the object sheet, open the field menu (☰), choose Open field details and note down the name.

Six are enough for this exercise: Inventarnummer, Objekttitel, Urheber, Titelbild (the cover image), Höhe and Leihvertragsnummer, plus Leihstatus and Leihende for the condition in step 5.

2. Create the template

A new Word file, and the first command:

{#$o[`Inventarnummer`] ?? ``#}
Backticks, not quotation marks

The characters around the field name are backticks (`), not quotation marks. Word likes to replace straight quotation marks with typographic ones, but it leaves backticks alone.

The part `?? ``` is an empty fallback. It belongs on every field, so that an empty field does not cause follow-on errors.

3. First test with two objects

  1. Save the file.

  2. In Moliri, narrow the object selection down to two loans, for example by pinning two objects and limiting the selection to the pinned ones.

  3. In the sidebar, open Data In- & Export and click Word reports under Export. In the dialog Export Word report, upload the file and choose Use directly. The file is then neither uploaded nor saved, which is exactly right for a test.

  4. Click Create Report and look at the result.

Two objects rather than two hundred: you find errors just as well, and the run takes seconds.

Moliri downloads the result as a .docx. This is what a finished report looks like, here the loan agreement from the demo template for two loans; your object sheet will be built in a similar way after step 4.

First page of the generated loan agreement for Leihanfrage Moderne 2026: borrower, place and loan period, below them the loaned items Rehe im Walde II by Franz Marc and Eselreiter by August Macke with object photo, date, technique, dimensions, inventory number and lender

4. Build out the object sheet

Back in Word, extend the template:

{#IMAGE img(($o[`Titelbild`] ?? null), { width: 8, height: 6 })#}

{#$o[`Inventarnummer`] ?? ``#}: {#$o[`Objekttitel`] ?? ``#}
{#$o[`Urheber`] ?? ``#}

Height: {#imask($o[`Höhe`], f[`Höhe`]) ?? `-`#}
Loan agreement: {#$o[`Leihvertragsnummer`] ?? `not yet`#}

What the new parts do:

ElementEffect
IMAGE img(…)Embeds the image, width and height in centimetres
?? null on the image fieldObjects without an image get a placeholder instead of an error
imask(wert, f[…])Formats the number the way the field is set up, with unit and number format

Test again with two objects.

5. A condition

Output a note about the return only for objects that are on loan:

{# IF $o[`Leihstatus`] === `Entliehen` #}
On loan, return by {#fdate($o[`Leihende`]) ?? `?`#}
{# END-IF #}

fdate writes the date as TT.MM.JJJJ (DD.MM.YYYY).

6. An image loop

All the object’s images, not just the cover image, such as the condition photos taken on arrival:

{# FOR file IN $f #}
{# IF [`image`, `image_other`, `svg`, `pdf`].includes($file.kind) #}
{# IMAGE img($file, { width: 6 }) #}
{# END-IF #}
{# END-FOR file #}
The most important pitfall

Inside a loop, the loop variable is written with $: $file, not file. Without the $ it is undefined and the export stops. This applies to every loop.

The condition on kind makes sure that, for example, scanned contracts in PDF form do not end up as illustrations on the object sheet if you do not want them there.

7. How the sheets come together

This template only uses $o. So one document is produced per object. How Moliri combines the documents is set in the export dialog under Advanced settings › Merge behavior:

ReportSetting
Object sheets, each on its own pageInsert section break (new page)
Labels one after anotherMerge without extra break
One file per objectDo not merge, pack as ZIP

The default Use template’s section behaviour takes over the section settings of the template.

8. Put it in the library

Once the template works, upload it again and choose Save to library. Moliri asks for the name. With Change category you assign it to a category in the library. From there it is available to everyone who is allowed to export.

In the demo holdings, the template Leihvertrag (loan agreement) is already there in the category Leihverkehr. Open it for comparison: it is built on the same principle, with commands in the text of a Word file. If you would rather carry on writing in the browser than in Word, choose Edit in EuroOffice when uploading.

Without Word: the template editor in the browser

Templates can also be written entirely in the browser. In the dialog Export Word report, New template creates one and Edit opens an existing one. The editor inserts fields together with their formatting, you save with Strg + S (Ctrl + S), and Preview shows the finished report. See Create a Word template .

What is clear now

ObservationWhere to go next
Commands are expressions in {# … #}Template syntax
$o, $f, f are data contextsTemplate variables
img, imask, fdate are helper functionsTemplate functions
A loop over all objects turns this into one document, such as an object listTemplate syntax

Next