Powershell - Using ConvertTo-HTML and need to add CSS based on a fields content -


i using powershell's (v2) convertto-html function convert sql query table include in email. on basic level works fine, want add css colour field if field greater 0.

my sql is:

$sql1 = "select date, ls, tco, fco test.table1          date = date_sub(curdate(), interval 1 day)         order ls" 

example data is:

'2015-09-29', 'aaa', 150, 10 '2015-09-29', 'bbb', 267, 0 

my powershell is:

$table1 = $result1 | ` convertto-html `     -property date, `         lsr, `         tco, `         fco `     -fragment   $htmlbody = @"     <html>     <head><title>html table</title></head>     <body>         <style> [css goes here] </style>         . . .         $table1     </body>     </html> "@            

but need able add css last field on table if field > 0 add class turn red. i'm assuming need kind of if statement somewhere

if [field] > 0 [add class] 

but can't see put it. possible?

from have been able deduce, not possible add css individual elements using convertto-html.

i did find function called called convertto-advhtml allow this.see here


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -