Skip to main content

One post tagged with "Word templates"

View all tags

Create advanced templates for document generation

· 12 min read
SEO and Content Writer

Document generation with mail merge is the trick of reading values from a data source and dropping each one into the matching placeholder in a template. You keep two things: a template that holds the merge fields (the variables waiting to be filled) and a data source that supplies the values plus everything that stays the same on every copy. PDF4me's reporting engine takes those two files and hands back a finished document.

PDF4me accepts Word, HTML, and PDF templates, and the richest of the three is Word. With a small, readable syntax you can design one Word template that covers invoices, receipts, contracts, quotes, or any personalized document, then generate thousands of them from data. This guide walks through the whole syntax — merge fields, conditions, formatting, tables, images, and inline HTML — with copy-paste examples and a sample template you can download and run. Every syntax link points at the exact page in the Word Template Syntax documentation.

The building blocks at a glance
Merge fields
The core placeholder. Write <<[FieldName]>> in Word and the engine swaps it for the matching value from your data.
Conditions
Show or hide content with <<if>>, <<elseif>> and <<else>> so one template covers every case.
Formatting
Shape a value inline with <<[token]:"format">> for dates, number formats and text case.
Tables and loops
Repeat a row or a whole section for every item in a list with <<foreach>>.
Images
Drop a logo, photo or signature into a text box with <<image [imageUrl]>> from a URL or Base64.
Inline HTML
Render pre-formatted HTML straight into the document with the <<[token] -html>> switch.