cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emfuentes27
Super User
Super User

Populate Word Template without with Rich Text SharePoint fields

As far as I know Power Automate is unable to Rich text Content Controls in MS Word. When I use just a Plain Text Content Control, it add a bunch of HTML tags, such as <div> and <p>, etc. I saw somewhere (can't recall where) that a workaround is to use a Repeating Section Content Control by creating an array. For example, I have data that look like this:

<div class="ExternalClassB8D4B82FCC774E82A9AA0B1B2EE583E1"><p>This is a paragraph. Very nice!</p><p>Another paragraph, great</p><p>Even more paragraphs</p><p>The end is here</p></div>

I started playing around using a Compose and split() with <p> as the separator, but the results look pretty bad:

 

[
  "<div class=\"ExternalClassB8D4B82FCC774E82A9AA0B1B2EE583E1\">",
  "This is a paragraph. very nice!</p>",
  "Another paragraph, great</p>",
  "Even more paragraphs</p>",
  "The end is here</p></div>"
]

How can I just extract just the text that is between <p> and </p>, and remove all the rest?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
emfuentes27
Super User
Super User

I think I figured out combining a bunch of Split, and Replace.

split(replace(replace(last(split(outputs('Get_item')?['body/Location_Text'], '">')), '</div>',''), '</p>',''), '<p>')

//Result --//

[
  "",
  "First Paragraph,",
  "Second Paragraph,",
  "Third Paragraph"
]

View solution in original post

1 REPLY 1
emfuentes27
Super User
Super User

I think I figured out combining a bunch of Split, and Replace.

split(replace(replace(last(split(outputs('Get_item')?['body/Location_Text'], '">')), '</div>',''), '</p>',''), '<p>')

//Result --//

[
  "",
  "First Paragraph,",
  "Second Paragraph,",
  "Third Paragraph"
]

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,769)