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
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,069)