How do I conditionally insert a multi-level list into a Word document?

August 31, 2021

You can conditionally insert text into your Microsoft Word template without breaking your document's list structure. For example, this Article 3 was conditionally inserted, causing Article 4 to automatically renumber itself (from 3 to 4): 

Make sure you're working with a Microsoft Word list

In order to conditionally insert text without breaking your list formatting, you must be working with a "true" Microsoft Word list (instead of plain text that is merely styled to look like a list). This 1 minute video provides a quick reminder of how lists work in Microsoft Word:

How it works

Quick reminder, any text you want to conditionally insert into your Word template must be encapsulated as a variable. In this case, we want to conditionally the text for Article 3, which means I must have a variable that is equal to that text. You can create such "text variables" either from the Word add-in (click "Create new variable") or from the App Builder (under the Blocks tab, add a Text Block).

Once you have a variable that is equal to the text you want to conditionally insert, place that variable in your Word template on a list item:

🎉 Great!

Now, whether or not this variable is inserted, your list will intelligently grow or shrink to accommodate it.

But what about the list within Article 3? To make sure those are formatted accordingly to the rules of your document we have to take one more step...

How to format multi-level lists

If your Text Variable includes a list, use the Afterpattern Word add-in formatting features to make sure that variable's list respects the formatting of your overall Word template. Meaning, just click the bulleted list or numbered list icons:

Don't worry about the style of list (meaning, the list displays 1, 2, 3 but your document's list is made up of Article 1, Article 2, Article 3 etc...), just make sure your list has the correct depths. When the document is auto-populated, the list in the Text Variable will change style to reflect the formatting of your overall Word template.

Video walkthrough

This video takes you step-by-step through this process:

Hire an Afterpattern expert

Go from idea to launch in weeks.

View services