Open
Description
I have issues related to formatting:
- Custom column widths. As you can see I am trying to set column width to 50 but whatever number I put in, nothing changes
- Custom font size. I am trying to set the font size to 12 but it keeps being 8
- Would like to define font info / formatting only once per whole HTML object and not multiple times.
I tried to use New-HTMLTableStyle with hopes that I could set my fonts for whole table in one place but it does not work and I have to set the fonts by using New-HTMLTableHeader and New-HTMLTableContent. That way I can actually set the font type but custom font size never works.
$UniqueRecipients | ForEach-Object {
$Mail = $_
# Construct HTML object
$EmailTable = $Table | Where-Object {$_.Mail -eq $Mail}
$Html = New-HTML {
New-HTMLText -Text "Your server(s) just started patching." -FontFamily 'Calibri' -FontStyle 'normal' -FontSize 12
New-HTMLTable -DataTable $EmailTable -HideFooter {
New-HTMLTableStyle -Type Table -FontFamily 'Calibri' -FontStyle 'normal' -FontSize 12
New-HTMLTableColumnOption -AllColumns -Width 50
New-HTMLTableHeader -Names ServerFQDN,PatchingStartDateTime,SkipXmonths,UtcOffset -FontFamily 'Calibri' -FontStyle 'normal' -FontSize 12
New-HTMLTableContent -ColumnIndex 1,2,3,4 -FontFamily 'Calibri' -FontStyle 'normal' -FontSize 12
}
}
Send-MailMessage -From "[email protected]" -To $Mail -Subject "OnDemand Patching - Startup notification" -Body $Html -SmtpServer smtp.server.com -Credential $Creds -BodyAsHtml
}