Skip to content

How to force the width of New-HTMLTable? #469

@TrevorW7

Description

@TrevorW7

I am using PSWriteHTML to format email. When I try New-HTMLTable, it seems the width is ignored and the table is always forced to 100% of the screen width. How do I force the size to less than the full screen width?

I tried:

  $html = New-HTML {
		New-HTMLPanel -Width '60%' -Content {
			New-HTMLTable -DataTable $data -HideFooter -ScreenSizePercent 60 {
				New-HTMLTableHeader -Names 'Filename' -FontFamily "Calibri" -FontSize 10 -Alignment Left -BackGroundColor '#2d5a8f' -Color White
				New-HTMLTableHeader -Names 'LineNumber' -FontFamily "Calibri" -FontSize 10 -Alignment Center -BackGroundColor '#2d5a8f' -Color White
				New-HTMLTableHeader -Names 'Line' -FontFamily "Calibri" -FontSize 10 -Alignment Left -BackGroundColor '#2d5a8f' -Color White
				#New-HTMLTableHeader -BackGroundColor Grey -Color White -Title 'Summary of Printer Backup Errors'
			}
		}
}

Neither the New-HTMLPanel resizes the table, nor the ScreenSizePercent parameter for New-HTMLTable.

How do I set the width when the HTML table is in the body of an email (I.e. read in Outlook)? Everything else works.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions