cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Perez
Helper V
Helper V

format table cells background with HTML

Hi,

im buliding a powerapp that eventually need to send a mail, i used the method suggested in this article in order to produce the formated mail as html and send it.

in my mauil im sending a table with status field i want the status to have diffrent background collor according to the value: good: green, moderate: yellow, bad: red.

i tried diffrnet combinations of the below formula but didnt manage,any ideas what would be the syntax for that?

 

<td width=104 colspan=2 valign=top style='width:78.0pt;border-top:none;border-left:none;border-bottom:solid;background ="""&If(Status="Good","#00B050", If(Status="Moderate"," yellow", If(Status="Bad"," red ")&""">"  windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt'><p class=MsoNormal>"& Status.Value &"<o:p></o:p></p></td>

 

thanks,

Eyal

3 REPLIES 3
RandyHayes
Super User
Super User

@Perez 

Please consider changing your Formula to the following:

<td width=104 colspan=2 valign=top style='width:78.0pt;border-top:none;border-left:none;border-bottom:solid;background:" & 
Switch(Status.Value, "Good", "#00B050", "Moderate", "yellow", "Bad", "red") & 
";border-right:solid;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal>" & Status.Value & "<o:p></o:p></p></td>

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes , thanks, it solved my issue, it work now perfectly!!!

have one more question, for some reson the html code add few empty rows at the bottom of the table, have any idea why? should i open a new issue for this one?

RandyHayes
Super User
Super User

@Perez 

How are you building your rows?  The Html you sent before only dealt with the specific section with the color.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,447)