web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Populate Multiple Imag...
Power Automate
Unanswered

Populate Multiple Images in a repeating section of a Word document with the Populate a Word Document action

(0) ShareShare
ReportReport
Posted on by 676

I am using PowerApps and Powser Automate to populate a Word template with repeating information from a PowerApps collection, including photos.  I have been able to successfully populate a repeating section (which includes a table, with text controls).  I was also able to include an image in a table cell (which is part of the repeating section, bounded by paragraph symbols) by using the Insert, Field, IncludePicture field.  However, this field points to a single image in a OneDrive folder, so the image is repeated with each repeat.

I want to make the filename portion of the path dynamic.  I have attempted to combine the path from the IncludePicture field with another text control containing the filename, but cannot seem to concatenate two text controls to produce the final full filename path.  Does anyone have experience combining or concatenating text controls?

 

The other option is somehow doing the concatenation on the Power Automate end, but this may be more difficult.

 

Happy to share what I have done so far if anyone is interested.  Since the Word template does not allow picture controls inside a repeating section, the IncludePicture field was a good workaround, but it is not dynamic.

Categories:
I have the same question (0)
  • 55552 Profile Picture
    676 on at

    Here is the exact requirement:

    PowerApps app has a collection of data, which could include a list of image/graphic filenames as one of the fields. Most fields are just plain text.  The images are just small png graphics stored on OneDrive, so they don't need to be accessed in PowerApps or pushed to Power Automate.

    PowerApps sends the Collection to a Power Automate flow for processing.

    A Word template is in place, which maps the fields from the Collection to specific locations in the Word document. the main part of the Word document is a formatted table (with about 4 rows, but some columns are merged, so not an exact grid. The "table" is enclosed in a repeating section control, and there are individual controls in different parts of the table.  One of the table cells eventually needs to hold an image/graphic, which would be different for each repeat, and based on the image filename pushed in from PowerApps for that row/repeat.

     

    The page in Word also needs to be formatted so that exactly three repeats can occur per page, after which the page would break, and continue to the next page.  There could be 5 to 20 or so repeats (depending on how many items are in the PowerApps collection.

     

    Power Automate then pulls in the data from PowerApps, parses the JSON, and popualates the Word template. This may or may not be feasible with the standard Populate a Word document in Power Automate because of the need to dyanmically include an image/graphic in one of the table cells.  I am not opposed to looking at Encodian if there is not way to accomplish this outside of a 3rd party connector, but would have to let my client know the monthly cost.

     

    The 10 MB limit would not be an issue, as these are small graphics/line drawings, not photos.

    Thanks for any further suggestions.

  • 55552 Profile Picture
    676 on at

    Looks we may be giving this a try later today, so I may need some assistance setting it up. I am famliar with using JSON, so that part will not be difficult. May need help in populating the image/graphic within a specific cell of a Word table. I can push in a filename as text in a cell using JSON, but then perhaps in the flow itself, i would use that filename to look up and get the image file contents from a OneDrive folder.  It would be within the repeating section, and would be dynamic, depending on the filename that is derived from the PowerApps collection.  I think for 3 repeats per page, we may not need logic, just set up the first section with the exact correct page height so that a page break would be forced every three repeats. However, if the logic is not too complicated, that would be an option.  The size of each repeat needs to be exact, because the prints/labels are printed on perforated paper, with perforations between repeat sections, and also a vertical performation off to the right.

  • 55552 Profile Picture
    676 on at

    Ok, here is my final solution that worked. I could not get the standard Populate Word action to work for my case (repeating section that includes a Word table as part of the repeat, with an image in one of the cells of the table).

    Using the Encodian Populate Word Document connector (they have a 30 day free trial), this is what worked:

    • Named each control according to the text data for that image that populates one of the PowerApps galleries (tables).
    • Inserted an image control into the gallery (which is like a repeating table).
    • Used a Switch statement for the name of the Image (the Image property). The switch statement uses all possible cases of image names, so depending on the string value of the image name in that row of the gallery, it looks up the image control from the screen that contains the raw images.
    • Pushes all text and the images into a collection.
    • Collection gets pushed to Power Automate.
    • In Power Automate, followed some of the Encodian instructions to reformat the JSON, including the replace statement to remove the extra text that comes in from PowerApps for each image:  "data:image/png;base64,"
    • In the Word template, I have a table within a repeat tag. One of the table cells contains a text box with the image tag that comes from PowerApps.

      I have a bit more formatting to do, the Encodian process has several "switches" for images that allow control over the size and ratio of the image. Note that the image must be contained in a text box, but that text box can easily be placed inside of a Word table cell.

  • 55552 Profile Picture
    676 on at

    Here is more detail on the final solution, for anyone interested. Using the Encodian Populate Word Document connector:

    Ended up using this code in the template just before the end of the for each control:

    <<if [kitItem.RowNumber == 0]>>    <<[ControlChar.PageBreak]>>  <<else>> <</if>>  <</foreach>>

     

    Every third repeat will have a Row Number = 0, which is calculated and pushed from PowerApps to Power Automate within the JSON.  The logic then checks for a 0, and if so, add a page break.

    The entire template looks like this:

    Runner55552_0-1687814558096.png

  • nicola_prad Profile Picture
    15 on at

    I'm trying to populate repeating sections that contain image controls and I had the very same issues. 

    I also tried INCLUDEPICTURE and I'm still hoping to find a method that involves only standard features and not the encodian connector. 

    It's not a matter of cost, but I'd rather rely on microsoft technology only.

    Did you happen to find an alternative method in these days? 🙂

  • 55552 Profile Picture
    676 on at

    No, I did not find an alternate solution, but Encodian worked for me, and had much better capabilities for handling images than the standard connector. Depending on how many flow actions you have per month, the Encodian free version might suffice.

     

    Since Encodian is simplay another third party connector, I would still classify it as "Microsoft" technology.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard