Avatar of E=mc2
E=mc2
Flag for Canada

asked on 

Configure Powershell to HTML Script

I would like to change the configuration on the following script so that the output is more pleasant on the eye with colours around the headings.

I would have added ConvertTo-Html -Head $css, if it was a normal ConvertTo-Html but as you can se I am using ConvertTo-EnhancedHTMLFragment instead..

$css = @"
<style>
h1, h5, th { text-align: center; font-family: Segoe UI; }
table { margin: auto; font-family: Segoe UI; box-shadow: 10px 10px 5px #888; border: thin ridge grey; }
th { background: #0046c3; color: #fff; max-width: 400px; padding: 5px 10px; }
td { font-size: 11px; padding: 5px 20px; color: #000; }
tr { background: #b8d1f3; }
tr:nth-child(even) { background: #dae5f4; }
tr:nth-child(odd) { background: #b8d1f3; }
</style>
"@

$Services = Import-CSV "Report1*" -Delimiter ',' | ConvertTo-EnhancedHTMLFragment -As Table -PreContent "<h2>Report 1</h2>" -MakeTableDynamic
$Services2 = Import-CSV "Report2*" -Delimiter ',' | ConvertTo-EnhancedHTMLFragment -As Table -PreContent "<h2>Report 2</h2>" -MakeTableDynamic
$Services3 = Import-CSV "Report3*" -Delimiter ',' | ConvertTo-EnhancedHTMLFragment -As Table -PreContent "<h2>Report 3</h2>"
ConvertTo-EnhancedHTML -HTMLFragments $Services, $Services2, $Services3 -CssUri C:\PowerShell\CSS\styles2.css | Out-File DynamicExample.html

Open in new window


How can I modify this so that I can apply the header information?
Or how should this be changed, any better ideas?
PowershellHTML* HTML 5Scripting Languages

Avatar of undefined
Last Comment
E=mc2

8/22/2022 - Mon