How to: Populate word template with Rich Text, Image & Repeating Content Control using MS Flow
In this #PowerShot, I will show you how to use the Pojectum Present It connector's "Generate Word Document" action to populate a word template with rich text, images in single fields and images as repeating content too.
Currently, this is a limitation with the available Microsoft Word Connector as it only allows plain text in repeating control and images, plain text in single fields. Another benefit of using the Projectum Present It connector is an added capability to work with PowerPoint presentations too.
Let's get started!
Creating the Word Template
Step 1: Add all the content controls for the non repeating content (Name) with simple text holders as shown in the screenshot.
Step 2: Create a table with two rows and the number of columns that you have the repeating content for. In the first row, create the headers for the content and in the second row, add the holders for the desired data using the tags as shown in the screenshot.
Step 3: Create a field and holder for the rich text format (in the form of HTML) as shown in the screenshot.
Step 4: Save the word template file and store it on an online document library from where you can access the file in MS Flow.
Note: You do not have to add the content controls for individual fields from the developer pane for this one. The connector action identifies the tags by default and updates those based on the JSON provided in MS Flow.
Step 1: Trigger: Manual - I am using the manual trigger and using the input parameters to allow a user to upload image files. These images will be used to populate the word template table.
Step 2: Action: Get file content using path from SharePoint - to get the file content of the word template stored in the document library.
Step 3: Action: Compose - Using this action we configure the fields to be populated in the word template. For repeating control such as in a table, create an array with the parent place holder and assign individual key value pairs for each field per row.
Step 4: Generate a Word Document - to generate a word document with the output of the compose action and the word template file retrieved from the SharePoint document library.
Step 5: Create a file in SharePoint - to create a file with the content generated in the previous step.
Step 7: Send the populated word template file as an email attachment.
In this post, we saw how to populate repeating control, rich text and images on a word template using MS Flow and Projectum Present It connector. The same thing can be replicated and scaled across different connectors and services when there is structured/tabulated data that needs to be populated in the document.
I strongly recommend to watch this video that demonstrates this connector/action with MS Flow.
I hope you found this interesting and it helped you!