Repeating Table Rows in 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.
Start with an invoice — free See the Word template
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:
| Item | Quantity | Price |
|---|---|---|
{#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.
Empty lists and separators#
If a list has no items, the whole block, including its heading, disappears. That is usually what you want: no "Deliverables" heading followed by nothing. Test it by generating a document with zero items. For commas and "and", use the {_last} marker shown above; for semicolons in a legal list, put the separator inside the loop instead.
Numbering a repeated list#
Use {_index} to print the item number, or let Word's own numbering continue. If you put the opening tag before a numbered paragraph and the closing tag after it, Word repeats the numbering for each item. Do not type the numbers yourself: they will be wrong as soon as an item is added.
A worked example: invoice lines#
{#items}
{description} | {qty} | {price} | {amount}
{/items}
In a table, the same tags go in the first and last cells of the row. The totals row stays outside the loop and uses a computed field such as sum(items.amount). That way the table grows with the list while the total stays in one place.
Lists inside lists#
A list item can contain its own optional details: {#parties}{name}{#is_company}, company number {company_number}{/is_company}{/parties}. Keep nesting shallow. If an item needs a list of its own, consider a separate section or a second template; deeply nested repeat blocks are hard for the person answering the questions to follow.
Common mistakes#
- Typing the tags as separate words. Copy them exactly, including the braces, or the template will treat them as text.
- Putting the closing tag outside the table row. Word will repeat the heading or the totals row instead of the data row.
- Using the same item name twice. Two lists called
itemsin one template will share answers. - Formatting the whole row by hand. Apply the style once to the template row; the repeat keeps it.
Test with one, two and none#
Generate a document with a single item, then with several, then with none. Check the borders, the spacing and the closing punctuation. A list that looks right with three items can leave a dangling "and" with one.
The free statement of work and engagement letter templates both use repeating lists, if you want a working example. The meeting minutes template repeats an action row the same way.
Download a starter template#
Questions
Can a repeating list contain a table?
A table row is the usual unit to repeat. Repeating a whole table inside a list is fragile in Word; instead, put the repeat tags in the first and last cell of the row you want to grow.
How do I repeat a paragraph but not its heading?
Put the opening tag after the heading and the closing tag at the end of the paragraph. The heading stays once; the paragraph repeats for each item.
What happens to questions inside a list?
Each item asks its own questions when the client adds it. Questions inside an optional block are only asked when that block applies to that item.
More on automating Word templates
- Automate Word Templates (No Portal Needed)
- Conditional Clauses in Word (Auto Add/Remove)
- Mail Merge vs Document Automation (Compared)
- Client Intake Without a Portal (Private Forms)
- Document Software: Confidentiality Checklist
Helpful?