Comment on post: Insert HTML and rich text into a Word Document with Power Automate

Blog post: Insert HTML and rich text into a Word Document with Power Automate



Hi I want to pass the richtext from power apps to a word document through an instant flow. How I can configure? Thanks.

Hello,

To transfer the rich text from the power apps you need to

  1. Add a token into your DOCX template with the HTML formatter.

image

  1. There is incorrect usage of the Template file in Create DOCX document from template action on the screenshot.
  • Pass the dynamic content from Power Apps in a JSON in the Template data field. The same as it's done for SharePoint.

image

or with Power apps dynamic content.

After running the action the token inside the DOCX template will be replaced with the power apps rich text content.

Best regards,
Petr
Plumsail team

Hello. I am passing an HTML table and the end result is the data without all the formatting.

This is the HTML I am passing:

table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid black; padding: 8px; text-align: left; } th { background-color: #f2f2f2; } .level-1 { background-color: #4b0082; /* Dark Purple */ color: black; font-weight: bold; } .level-2 { background-color: #9370db; /* Light Purple */ color: black; text-decoration: underline; }
C1 C2 C3 C4 C5 C6 C7 C8 C9

This HTML is working properly if I send it over e-mail for example.

adding a screenshot as the HTML didn't display properly in the comment:

Hi @Pavel_Benev,

Do you use the HTML formatter inside a DOCX template like this and Power Automate action Create DOCX from template?

Could you share the DOCX template, and a screeshot with the action where you insert the HTML code? Is it possible to attach a txt file with your HTML code too?

Best regards,
Petr
Plumsail team

.

Hi @Petr and thank you for writing back.
Yes, this is my exact scenario. I have a word template
Document.docx (18.2 KB)
and I think I am following the instructions for using the HTML formatter inside the file.
I generate my HTML inside power automate and it looks like this:
HTML.txt (1.9 KB)
There is a variable RowsPlaceholder that I am providing later but I don't think it is important for this purpose because even the header's styling is not working.
At the end, this is how PA looks like:
image
Again I want to mention my disclaimer - the table is inserted in the word document but without any formatting at all. This HTML is rendering as expected when sent over an e-mail for example.

Waiting for your feedback :slight_smile:

Thanks and regards,
Pavel

1 Like

Hi @Pavel_Benev,

The <style> tag is not supported in the formatter. Please check the list of supported tags in the documentation.

Best regards,
Petr
Plumsail team