Whenever you use ConvertTo-Html, the output is usually.. meh. However, you can add some CSS styling and include it in the converting process:
$Header = @"
<style>
Body{background-color:white;font-family:Arial;font-size:10pt;}
Table{border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
TH{border-width: 1px; padding: 2px; border-style: solid; border-color: black; background-color: #cccccc;}
TD{border-width: 1px; padding: 5px; border-style: solid; border-color: black; background-color: white;}
</style>
"@
Get-Process | ConvertTo-Html -Head $Header | Out-File C:\temp\process.htm
Which gives a little more oomph to your HTML output:
You can also put the CSS code in a separate file (e,g, D:\table.css), and include the CSS with
ConvertTo-Html -CssUri "D:\table.css"
No comments:
Post a Comment