Skip to content

Repeating lists and table rows in Word templates

Published · Automating Word templates

Contracts and letters often list things: parties, attorneys, deliverables, beneficiaries, line items. The number changes every time. Here is how to make a Word template handle any number of them.

Repeat a paragraph or bullet

{#deliverables}
• {title}: {description}, due {due_date}
{/deliverables}

Everything between {#deliverables} and {/deliverables} is written once per deliverable. In the questionnaire, the person drafting clicks Add deliverable as many times as needed, and each item has its own title, description and due date.

Repeat a table row

Put the opening tag at the start of the first cell of a row and the closing tag at the end of the last cell of the same row:

ItemQuantityPrice
{#items}{name}{qty}{price}{/items}

The whole row repeats, so the table grows with the list and keeps your borders and shading.

Commas between names

To write "Ann, Ben and Cara"-style lists, use the built-in {_last} marker, which is true on the final item:

{#parties}{name}{^_last}, {/_last}{/parties}

{_index} gives the item number (1, 2, 3) and {_count} the total, which is useful for "Schedule {_index} of {_count}".

Optional details inside an item

Conditions work inside lists too: {#attorneys}{name}{#is_partner}, Partner{/is_partner}{/attorneys} asks a yes/no question for each attorney.

Totals

A computed field such as sum(items.price) adds up a column, and count(items) counts the rows. See logic and calculations.

The free statement of work and engagement letter templates both use repeating lists, if you want a working example.

More on automating Word templates

All guides

NDAs and restrictive covenants

Hiring and HR letters

Freelancing and getting paid

Landlords and tenants

Business deals, money and releases