css - How to make a column bold in HTML output -


below powershell script. produces nicely formatted html table. i'd make single column bold (full % column). can't life of me think of way it.

i've tried inserting bold tags in different places , tried thinking of way use replace since numbers change in columns can't think of way it.

$symmid = 1555 $command1 = symfast -sid $symmid list -association -demand $command2 = symcfg -sid $symmid list -thin -pool -detail -gb $basedir = "c:\ts\scripts" $timestamp = get-date -format ddmmyyyy $cssfile = "$basedir\csstemplate.css"  $css = get-content $cssfile   $command1 > $basedir\archive_vp\archive_$timestamp.txt $command2 > $basedir\archive_pool\archive_$timestamp.txt  $regex = '(?ms)p o o l s(.+?)\r\n\s*\r\n' $command2 = $command2 -join "`r`n" $command2 = [regex]::matches($command2,$regex) | foreach {$_.groups[1].value} $command2 = $command2 -split "`r`n" | select -skip 5  $command2format = $command2 | % {   $column = $_ -split ' +'   $hash = [ordered]@{    'pool name'  = $column[0]    'flags ptecsl'  = $column[1]    'dev config'    = $column[2]    'total gbs'      = $column[3]    'usable gbs'    = $column[4]    'free gbs'       = $column[5]    'used gbs'       = $column[6]    'full (%)'       = $column[7]    'subs (%)'       = $column[8]    'comp (%)'       = $column[9]    'shared gbs'    = $column[10]    }  new-object -type pscustomobject -property $hash } | convertto-html -head $a   function get-css {     foreach($line in $css)     {         $style += $line     }     return $style }   $style = "<style>" $style = get-css $style += "</style>"  $report = "<html><head>$style</head><body>$command2format</body></html>"   $report | out-file $basedir\test.html invoke-expression $basedir\test.html 

output:

enter image description here

you should able follow basic example looking

$a = @" <style>     td:nth-child(1){font-weight: bold} </style> "@  get-childitem c:\temp -directory | select name,lastwritetime | convertto-html -head $a | set-content c:\temp\file.html  ii c:\temp\file.html  

so defined nth-child(1) first column of data have text bolded. should able accomplish same thing 7th column.

yes, tim ferrill says, need browser support should not tall order.

sample output


Comments