cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Specoop
Helper III
Helper III

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.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,147)