cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Specoop
Advocate II
Advocate II

HTMLText (Table) into Microsoft Word Template - how to keep formatting

Hello - I've got an HTMLText in my PowerApp that displays colors depending on the number.  

2020-05-27_16-53-12.jpg

 

 

 

 

 

 

 

 

"<!DOCTYPE html>
<html>
<body>
<Table width='100%' border='1' cellpadding='5' style='border:0px solid black; border-collapse:collapse'>" &
"<tr style='background-color:#efefef'>
<td align='left'><b>Leadership and Management</b></td>
<td align='left'><b>"&'L&M-Total'.Text&"<b></td>
</tr>"
& Concat(Filter(collCAPReport, Component.Value = "a. Leadership and Management"), "<tr><td>" & Title & "</td><td><font color="""&If(Answer="1", "Red", Answer="2", "LightCoral", Answer="3", "DarkGoldenRod", Answer="4", "LightGreen", Answer="5", "Green")&""">" & Answer & "</font></td></tr>")&
"
</table>
</body>
</HTML>
"

 

The Table is generated from a collection that has two rows: Title and Answer. 

 

I'm hoping to get this exact table (with colors) into a Template Word Document.

 

I know that you can't insert the HTML into the Word Template at this time (boo), but so far I've got the following: 

  - I'm thinking we're close using this the repeating method:  - https://www.youtube.com/watch?v=-1jsBllmr-w.

  - Is there something in PowerApps or Flow that I can apply a similar If statement that gets color?

  - On the Word side of the house, I read some stuff about Merge and */char, but I'm thinking Flow/PowerApps maybe easier?

 

You talking to a bit of a noob here, but would really appreciate any assistance. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Specoop ,

Do you want to populate the HTML Text from your canvas app to a Microsoft Word Template through Power Automate flow?

 

Based on the needs that you mentioned, I afraid that there is no way to achieve your needs. Currently, the Rich Text Content Control is not supported under Microsoft Word (Business) connector, so there is no control could render the HTML Text within Microsoft Word Template .

Please check the following article for more details:

https://docs.microsoft.com/en-us/connectors/wordonlinebusiness/#known-issues-and-limitations

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, you could consider generate PDF file based on your HTML text instead of Word file in your OneDrive folder. I have made a test on my side, please consider take a try with the following flow's configuration:

9.JPG

Then within your canvas app, set the Html Text property of the Html Text control (HtmlText1) to following:

"<!DOCTYPE html>
<html>
<body>
<Table width='100%' border='1' cellpadding='5' style='border:0px solid black; border-collapse:collapse'>" &
"<tr style='background-color:#efefef'>
<td align='left'><b>Leadership and Management</b></td>
<td align='left'><b>"&'L&M-Total'.Text&"<b></td>
</tr>"
& Concat(Filter(collCAPReport, Component.Value = "a. Leadership and Management"), "<tr><td>" & Title & "</td><td><font color="""&If(Answer="1", "Red", Answer="2", "LightCoral", Answer="3", "DarkGoldenRod", Answer="4", "LightGreen", Answer="5", "Green")&""">" & Answer & "</font></td></tr>")&
"
</table>
</body>
</HTML>
"

Then add a button, set the OnSelect property to following (press it to fire flow action😞

'Flow Name'.Run(HtmlText1.HtmlText)

 

Please consider take a try with above alternative solution, then check if it could help in your scenario.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @Specoop ,

Do you want to populate the HTML Text from your canvas app to a Microsoft Word Template through Power Automate flow?

 

Based on the needs that you mentioned, I afraid that there is no way to achieve your needs. Currently, the Rich Text Content Control is not supported under Microsoft Word (Business) connector, so there is no control could render the HTML Text within Microsoft Word Template .

Please check the following article for more details:

https://docs.microsoft.com/en-us/connectors/wordonlinebusiness/#known-issues-and-limitations

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, you could consider generate PDF file based on your HTML text instead of Word file in your OneDrive folder. I have made a test on my side, please consider take a try with the following flow's configuration:

9.JPG

Then within your canvas app, set the Html Text property of the Html Text control (HtmlText1) to following:

"<!DOCTYPE html>
<html>
<body>
<Table width='100%' border='1' cellpadding='5' style='border:0px solid black; border-collapse:collapse'>" &
"<tr style='background-color:#efefef'>
<td align='left'><b>Leadership and Management</b></td>
<td align='left'><b>"&'L&M-Total'.Text&"<b></td>
</tr>"
& Concat(Filter(collCAPReport, Component.Value = "a. Leadership and Management"), "<tr><td>" & Title & "</td><td><font color="""&If(Answer="1", "Red", Answer="2", "LightCoral", Answer="3", "DarkGoldenRod", Answer="4", "LightGreen", Answer="5", "Green")&""">" & Answer & "</font></td></tr>")&
"
</table>
</body>
</HTML>
"

Then add a button, set the OnSelect property to following (press it to fire flow action😞

'Flow Name'.Run(HtmlText1.HtmlText)

 

Please consider take a try with above alternative solution, then check if it could help in your scenario.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,203)