Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

ConvertTo-HTML inserts empty table tag

$
0
0

When using ConvertTo-HTML with no input object and only -body and -head tags, the output contains a trailing set of empty <table> tags. This causes some minor graphical glitching when emailing the contents via Outlook. Apart from dumping the output to a string and manually searching/replacing the empty tags, is there an option that will suppress this spurious tag?

Sample code:

$a = Get-Process |Convertto-html -fragment
$b = Get-service |Convertto-html -fragment
convertto-html -body "$a $b"

This comes up a lot for me as my usual flow is to build up a report in pieces and then to combine the report segments with CSS via a final ConvertTo-HTML with -body and -head tags for style application.

David


Viewing all articles
Browse latest Browse all 13067

Trending Articles