Back to Blog
·VerseBlocks

Repeating rows and conditional sections in a Word template

Power AutomateDocument GenerationDataversePower Platform

The Dataverse query behind a document generation flow is rarely the hard part. Pull the record, flatten a couple of lookups, map fields to placeholders, and that piece is usually done in an afternoon. The template is where people lose days. A table that needs one row per line item, a paragraph that should only appear when a field carries a value, a picture that should sit inside its frame instead of stretching sideways. All of that forces you into the Word Developer tab, and the Developer tab gives no guidance once you are there.

Power Automate's Populate a Microsoft Word template action works against a fixed, narrow set of content controls. Word itself offers a lot more than that. Treating the two lists as the same thing is how a two hour template build turns into three days of guessing why a field will not populate.

Which content controls Power Automate actually supports

Word has documented ten content control types across its history. The original nine, present since Word 2010, are Rich Text, Plain Text, Picture, Building Block Gallery, Combo Box, Drop-Down List, Date, Checkbox and Group, according to Microsoft's own content controls documentation. Word 2013 added a tenth, Repeating Section, built specifically to repeat a paragraph or a table row.

The Populate a Microsoft Word template action supports five of the ten. Microsoft's connector reference names them directly: Plain Text Content Control, Combo Box Content Control, Drop-Down List Content Control, Image Content Control and Repeating Section Content Control. The same reference states plainly that Rich Text, Building Block Gallery, Date Picker, Check Box and legacy form controls are not supported. Group control is not in the supported list either, so treat it as unsupported too, which puts six content control types outside this action's reach: Rich Text, Building Block Gallery, Date Picker, Checkbox, Group and the legacy form field mechanism.

If a template designer hands you a document full of Rich Text controls because that is what feels natural to type into, the flow will not touch them. You rebuild those fields as Plain Text, and you give up inline formatting and native multi-paragraph handling when you do. Only .docx files work with this action, .dotx template files are rejected outright, and every content control name in the document has to be unique or the action cannot tell which placeholder gets which value.

Plain Text is the control you will use most often, and it costs you formatting. Plain Text content controls store no formatting at all, so whatever font or spacing you want has to live in the surrounding paragraph. By default the control accepts a single line. Turn on "Allow carriage returns" in Content Control Properties and the connector documentation confirms new line characters render in the output. Leave that setting off and a multi-line value gets collapsed or cut. HTML fares no better. There is no documented feature that lets a Plain Text control interpret markup, so a string built with HTML tags comes through as literal visible characters, not formatting.

Picture is the other control you will use constantly, called Image Content Control inside the connector. It accepts base64-encoded image data with content type metadata, and only JPG and PNG formats are supported. The control resizes to whatever dimensions the placeholder holds, and it does not maintain the source image's aspect ratio automatically, per the connector's documentation. Drop a portrait photo into a placeholder shaped for a wide image and it stretches to fill that shape. If proportions matter, resize the image before it reaches the flow, or resize the placeholder to match it ahead of time. Leave the placeholder image itself in the template rather than deleting it. Delete it and the control resets to its default size.

How repeating sections bind to your data

Repeating Section is the control that does the actual repeating work. It wraps a paragraph or a table row, along with whatever other content controls sit inside it, and repeats the whole block once per record. In Power Automate, you bind it to an array of JSON objects, and the keys in each object correspond to the titles of the content controls nested inside the section, according to the connector reference. A valid payload looks like two objects in an array, each carrying the same two keys, one set of values for row one and a different set for row two.

Every nested control needs a unique title. Leave a nested control untitled and Word assigns it a random title automatically, which makes it nearly impossible to target reliably from the flow. Give two nested controls the same title and both get replaced with the same value without any warning, which is a much harder bug to spot than a missing field.

Word's own repeating section mechanism, separate from how Power Automate maps to it, distinguishes two kinds of XML binding. If the underlying mapping does not intersect with an item in the node set as part of its parent chain, that is an absolute binding, and the same content shows in every repeated item. If it does intersect, that is a relative binding, and the mapping is recalculated relative to each item's own node. This distinction is more relevant to people building custom XML parts by hand than to a standard flow, but it explains why some repeating sections show identical text in every row instead of each row's own data.

One thing the research behind this piece does not turn up is documented behaviour for binding a repeating section to an empty array. Test that case yourself before you ship a template that might receive zero line items, because there is no published answer for what the section does when there is nothing to repeat.

How to repeat a table row without losing it to nesting

The documented procedure is simple to state and easy to get wrong in practice. Build the table first, select the entire row you want repeated, then apply the Repeating Section content control from the Developer tab. That is the whole method, according to Microsoft's connector guidance.

The failure mode shows up when you nest one repeating section inside another inside the same table. If a parent and a child repeating section both end in the same table cell, adding or removing an item in the child deletes the outer section entirely, per Word's content controls documentation. The fix Microsoft documents is to add a paragraph marker between the end of one repeating section and the start of the next, then hide that marker so it does not show in the finished document.

Power Automate adds its own restriction on top of Word's. Nested image content controls inside a repeating section are not supported by the connector at all. A Microsoft Q&A thread from April 2024 notes that nested repeating section content controls may not work with the Populate action either, so a line-item table with a further nested breakdown per line is not a safe pattern to build here.

Two limits sit underneath everything above. The template file, both going in and coming out, has to stay under 10 MB, and the whole conversion has to finish inside two minutes or the request times out, per the connector's own reference. A repeating section with heavy formatting or a lot of embedded pictures is the usual way a template creeps toward either ceiling. Those two figures are only part of the picture. The full set of limits on the Populate action covers the rest.

Why Word has no conditional content control

Word content controls have no native conditional display feature. There is no built-in "ShowWhen" property, no toggle that hides a paragraph when a bound value is blank, according to a Microsoft Q&A answer on the subject. If you came looking for a control that behaves that way, it does not exist, and no amount of searching the Developer tab will find it.

The documented workaround is an IF field, combined with a content control and a bookmark. You write a field code that compares a bound value against a condition and returns one block of text or another, and you anchor the comparison to a bookmark so the field can see the value. Word 2013 and later also has a separate feature called conditional sections, built for content assembly around whole paragraphs, but that is a distinct mechanism from the content control system this connector uses, and Microsoft's documentation does not connect it to the Populate action specifically.

The IF field approach works, and it costs you. You are hand-building field codes in a dialog that gives you no autocomplete and no validation, and a typo in the comparison syntax fails silently rather than throwing an error you would notice. Every value the field compares against still has to be fed through the same content control mechanism as everything else, so you end up maintaining two layers, the value and the condition, where a simple template just has one. Before you commit real content to this pattern, test the field syntax and the bookmark references in a tool like the Template Playground, rather than discovering a broken condition only after a live flow has already generated a document with the wrong paragraph in it.

What actually breaks a template's bindings

Three habits account for most of the broken templates people bring to support threads. Editing the display text inside a content control directly, including something as small as a capitalisation change or adding a word, can break its XML mapping, according to a Microsoft Q&A thread from May 2024. AutoCorrect can do the same thing without anyone touching that control directly, silently rewriting text inside it while the user types somewhere else on the page. And editing or uploading the file through SharePoint can strip the mapping outright. If you open Content Control Properties on the Developer tab afterwards and the XML mapping field shows none instead of a bound path, the binding that used to be there is gone.

Commingling content controls with the older legacy form field checkboxes causes a related problem. Once a legacy checkbox gets focus, the content controls around it lock for editing, according to a separate Microsoft Q&A thread. Any document the Populate action itself generates also comes back with its content controls locked and greyed out in Word desktop by design, a different situation from a template losing its binding, but one that still surprises people.

Word Online will not help here either, because the Developer tab does not exist in the browser version at all. Template creation in Word for Mac is not supported for this action. Edit templates and check bindings in Word desktop on Windows, every time.

Two settings make a template more likely to survive contact with the next person who opens it. Set the content control display mode to Start/End tags rather than the default bounding box, from Content Control Properties, so a later editor sees exactly where a mapped boundary starts and stops instead of a shaded rectangle that disappears once they click away. And before handing a template off, double-click into every control and replace its placeholder text with real display text. A control still showing placeholder text signals something unfinished, and typing over it is exactly the text edit that breaks the mapping underneath.