Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Use Word template to replace, include and exclude sections

(0) ShareShare
ReportReport
Posted on by 61

Hi all, 

I am hoping you can help me as I feel this request is not too far out of the box. 

I have a Word template that is a quote. Based on variables stored in a table, different sections of the quote should;

  1. Be replaced (e.g. Client Name would be a placeholder/bookmark that would be replaced with the client name)
  2. Be removed (e.g. I have multiple sections that have predefined text, and depending on the options the client is taking up, the sections that are not relevant should be removed)

I can see how 1 can be done but I cannot see how 2 can be done without going to 3rd party apps. 

Does anyone know of a way to do this with standard or premium connectors?

 

Let me know if the context is not clear enough and I will expand but hoping this is enough to get an idea on what I am looking to acheive. 

 

Thanks, 

 
  • Suggested answer
    AlexEncodian Profile Picture
    AlexEncodian 4,302 on at
    Use Word template to replace, include and exclude sections
     
    Encodian's Populate Word Document action has powerful document generation features that can handle all your requirements and more.
     
    In your instance, you could use Conditional Expressions in the template to conditionally insert text or remove it. You could also use conditional expressions to do the logic only and then Inserting Document content into that placeholder if the criteria is met.
     
    For 2)
     
    <<if [conditional_expression1]>>
      Show this data
      <<else>><</if>>
     
    By leaving the space between <<else>> and closing <</if>> blank, the section will be removed completely if expression is not met. 
  • narayan225 Profile Picture
    narayan225 2,390 on at
    Use Word template to replace, include and exclude sections
    This is possible with document generation toolkits like docentic or nintex. However, they are limited in Power Automate though.
     
    You can instead use a reverse logic or multiple templates.
    Here are the some ideas:
    1. instead of removing a section, create an empty content control in the word document and then based on the inputs, you can either leave it blank or populate the content.
    2. Create multiple templates for multiple conditions and fill them up based on the input condition.
    3. If your end goal is to create PDF, you can use HTML compose to create the content for your pdf. With HTML you can create the content right within Power Automate and use expressions and other conditional logic to create the text exactly what you want.
    Hope these ideas help.
    Cheers!

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,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard