Skip to main content

Notifications

Power Automate - Using Connectors
Unanswered

Populate word template with array of images

(1) ShareShare
ReportReport
Posted on by 20

I am trying to create a flow that takes all images from share point folder and populate in word template. Currently folder in sharepoint and word template both have 4 images with .png extenstion and 4 image placeholders respectively.
i have tested the base64 prefectly encode to the required image . i am not sure why populate ms word template not working, is it license issue.

i read online that instead of array, one sud declare it object and then populate, but i m not sure how to do it also things work good with single image, but how abt array of images.

can it be license issue

Categories:
  • swami12345 Profile Picture
    swami12345 20 on at
    Re: Populate word template with array of images

    hi @AlexEncodian I tried the approach, but its not working for me,

    below is my QR code array 

    {
    "QRCodes": [
    {
    "Name": "Test",
    "Base64image":"@{first(variables('QRCodes'))}",
    "Floor_Number":"@{first(variables('Floor_Number_Array'))}",
    "Structural_Condition":"@{first(variables('Structural_Condition_Array'))}",
    "Element_ID":"@{first(variables('Element_ID_Array'))}",
    "Remarks":"@{first(variables('Array_Remarks'))}"

    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),1))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),1))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),1))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),1))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),1))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),2))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),2))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),2))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),2))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),2))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),3))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),3))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),3))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),3))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),3))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),4))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),4))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),4))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),4))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),4))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),5))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),5))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),5))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),5))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),5))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),6))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),6))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),6))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),6))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),6))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),7))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),7))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),7))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),7))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),7))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),8))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),8))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),8))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),8))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),8))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),9))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),9))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),9))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),9))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),9))}"
    },
    {
    "Name": "Test",
    "Base64image":"@{first(skip(variables('QRCodes'),10))}",
    "Floor_Number":"@{first(skip(variables('Floor_Number_Array'),10))}",
    "Structural_Condition":"@{first(skip(variables('Structural_Condition_Array'),10))}",
    "Element_ID":"@{first(skip(variables('Element_ID_Array'),10))}",
    "Remarks":"@{first(skip(variables('Array_Remarks'),10))}"
    }]
    }, error is 

    {
      "HttpStatusCode"400,
      "HttpStatusMessage""Bad request",
      "Errors": [
        "The following error occurred populating the word document provided:  Tag 'value' is not well-formed. Token 'value' is unexpected."
      ],
      "OperationStatus""Error"
    }. What changes should i make 1.png2.png4.png
  • AlexEncodian Profile Picture
    AlexEncodian 4,320 on at
    Re: Populate word template with array of images

    @swami12345 

     

    Please have a look at the Template Syntax documentation. The Template Library also has many examples of how to configure templates. For basic text merge fields, have a read of Template Syntax Overview

  • swami12345 Profile Picture
    swami12345 20 on at
    Re: Populate word template with array of images

    hi @AlexEncodian 

    how can i modify encodian template to include the other info like Element_ID, Floor_Number etccurren1.png

    current Encodian template looks like 

    2.png

     

    aldo my http request is also not able to fetch the info like ElementID, Floor_Number3.png

  • AlexEncodian Profile Picture
    AlexEncodian 4,320 on at
    Re: Populate word template with array of images

    @swami12345 Yes - its easy to do in the Encodian template as per the links I provided below.

  • swami12345 Profile Picture
    swami12345 20 on at
    Re: Populate word template with array of images

    @AlexEncodian 

    Thank you for your feedback.

    I want to know whether i can modify the Encodian template as per my requirement. If yes, then can i develop JSON for the template to use in Power-automate flow.

  • AlexEncodian Profile Picture
    AlexEncodian 4,320 on at
    Re: Populate word template with array of images

    @swami12345 

     

    You need to implement a different Template Syntax, specifically around Repeating Content and Images. Have a look at the QR Sheet example in the Template Library.

     

    In your flow, you would just use Encodian's Populate Word Document action rather than using the Word connector action. Just search for Encodian when adding an action and you'll find it.

     

    Have a look at this video:

    Advanced Scenarios Populate a Word Document with Power Automate (youtube.com)

     

    Note, Encodian is a 3rd party connector. You need to create an account at the link below. No credit card information required and its free for 50 credits per month.

    Encodian Flowr — the Ultimate Standard Power Automate Connector

  • swami12345 Profile Picture
    swami12345 20 on at
    Re: Populate word template with array of images

    @AlexEncodian 

    how can i modify my flow so that i can populate the images from an array in the word template using Encodian's populate word template

  • AlexEncodian Profile Picture
    AlexEncodian 4,320 on at
    Re: Populate word template with array of images

    @swami12345 

     

    I believe the native Word connector works by mapping an image to an image content control in the template. So as you suggest, you have to declare each individually rather than passing through an array of images. It also means you have to know how many images you will populate in advance. Since you know you will have 4 images, it should work for you?

     

    If you need more flexibility or want to pass through an array of images, you can do this using Encodian's Populate Word Document action. Its a standard connector but 3rd party (generate 50 word documents per month free). It handles x number of images and image arrays.

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard

Featured topics