Project

PSWriteHTML

Generate HTML reports, dashboards, and emails from PowerShell without writing HTML, CSS, or JavaScript.

Stars 1,023
Forks 115
Open issues 54
PowerShell Gallery downloads 7,576,901
Release v1.45.0
Language: PowerShell Updated: 2026-11-03
Command

New-HTMLTableStyle

Module
PSWriteHTML

Apply new style for HTML Table

Syntax

New-HTMLTableStyle
[-BackgroundColor <String>]
[-BorderBottomColor <String>]
[-BorderBottomStyle <Object>]
[-BorderBottomWidthSize <String>]
[-BorderLeftColor <String>]
[-BorderLeftStyle <Object>]
[-BorderLeftWidthSize <String>]
[-BorderRightColor <String>]
[-BorderRightStyle <Object>]
[-BorderRightWidthSize <String>]
[-BorderTopColor <String>]
[-BorderTopStyle <Object>]
[-BorderTopWidthSize <String>]
[-FontFamily <String>]
[-FontSize <String>]
[-FontStyle <normal|italic|oblique>]
[-FontVariant <normal|small-caps>]
[-FontWeight <String>]
[-TextAlign <left|right|center|justify>]
[-TextColor <String>]
[-TextDecoration <line-through|overline|underline>]
[-TextTransform <uppercase|lowercase|capitalize>]
[-Type <String>]
[<CommonParameters>]
#
Parameter set: Manual

Description

. Currently only works with DataTables (javascript). It doesn't affect CSS only tables (emails, etc). Keep in mind this affects all tables, not just one.

Examples

Example 1

$Table = Get-Process | Select-Object -First 3

New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor Yellow -TextColor Aquamarine -TextAlign center -Type RowOdd New-HTMLTableStyle -BackgroundColor Red -TextColor Aquamarine -Type Button New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor DarkSlateGray -TextColor Aquamarine -TextAlign center -Type RowEven New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor DarkSlateGray -TextColor Aquamarine -TextAlign center -Type Row New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor DarkSlateGray -TextColor Aquamarine -TextAlign center -Type Header New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor Orange -TextColor Aquamarine -TextAlign center -Type Footer New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor Orange -TextColor Aquamarine -TextAlign center -Type RowSelectedEven New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor Green -TextColor Aquamarine -TextAlign center -Type RowSelectedOdd New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor Yellow -TextColor Aquamarine -TextAlign center -Type RowHover New-HTMLTableStyle -FontFamily 'Calibri' -BackgroundColor Red -TextColor Aquamarine -TextAlign center -Type RowHoverSelected New-HTMLTableStyle -Type Header -BorderLeftStyle dashed -BorderLeftColor Red -BorderLeftWidthSize 1px New-HTMLTableStyle -Type Footer -BorderLeftStyle dotted -BorderLeftColor Red -BorderleftWidthSize 1px New-HTMLTableStyle -Type Footer -BorderTopStyle none -BorderTopColor Red -BorderTopWidthSize 5px -BorderBottomColor Yellow -BorderBottomStyle solid New-HTMLTableStyle -Type Footer -BorderTopStyle none -BorderTopColor Red -BorderTopWidthSize 5px -BorderBottomColor Yellow -BorderBottomStyle solid New-HTMLTableStyle -Type Footer -BorderTopStyle none -BorderTopColor Red -BorderTopWidthSize 5px -BorderBottomColor Yellow -BorderBottomStyle none

New-HTML -ShowHTML -HtmlData { New-HTMLTable -DataTable $table -HideButtons {

} -DisablePaging } -FilePath $PSScriptRoot\Example7_TableStyle.html -Online

Parameters

-BackgroundColor String optional
Set the background color. Choose one of the 800 colors or provide a hex value.
-BorderBottomColor String optional
Set the border color for the bottom border
-BorderBottomStyle Object optional
Set the border style for the bottom border. Allowed options are: 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'
Possible values: hidden, dotted, dashed, solid, double, groove, ridge, inset, outset
-BorderBottomWidthSize String optional
Set the border width for the bottom border
-BorderLeftColor String optional
Set the border color for the left border
-BorderLeftStyle Object optional
Set the border style for the left border. Allowed options are: 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'
Possible values: hidden, dotted, dashed, solid, double, groove, ridge, inset, outset
-BorderLeftWidthSize String optional
Set the border width for the left border
-BorderRightColor String optional
Set the border color for the right border
-BorderRightStyle Object optional
Set the border style for the right border. Allowed options are: 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'
Possible values: hidden, dotted, dashed, solid, double, groove, ridge, inset, outset
-BorderRightWidthSize String optional
Set the border width for the right border
-BorderTopColor String optional
Set the border color for the top border
-BorderTopStyle Object optional
Set the border style for the top border. Allowed options are: 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'
Possible values: hidden, dotted, dashed, solid, double, groove, ridge, inset, outset
-BorderTopWidthSize String optional
Set the border width for the top border
-FontFamily String optional
Specify the font to be used for text.
-FontSize String optionalaliases: TextSize
Set font size for the text.
-FontStyle String optional
Set different font styles to be used for text. Allowed styles: 'normal', 'italic', 'oblique'
Possible values: normal, italic, oblique
-FontVariant String optional
Set different font variant to be used for text. Allowed variants: 'normal', 'small-caps'. In a small-caps font, all lowercase letters are converted to uppercase letters. However, the converted uppercase letters appears in a smaller font size than the original uppercase letters in the text.
Possible values: normal, small-caps
-FontWeight String optional
Set font weight for the text. Allowed options: 'normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'
Possible values: normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900
-TextAlign String optionalaliases: Align, FontAlign
Set the text alignment. Allowed options are: 'left', 'right', 'center', 'justify'
Possible values: left, right, center, justify
-TextColor String optional
Set the text color. Choose one of the 800 colors or provide a hex value.
-TextDecoration String optional
Set different font decoration. Allowed options are: 'none', 'line-through', 'overline', 'underline'
Possible values: line-through, overline, underline
-TextTransform String optional
Set different text transform. Allowed options are: 'uppercase', 'lowercase', 'capitalize'
Possible values: uppercase, lowercase, capitalize
-Type String optional
Choose type to apply style on. You can choose from: 'Content', 'Table', 'Header', 'Row', 'Footer', 'RowOdd', 'RowEven', 'RowSelected', 'RowSelectedEven', 'RowSelectedOdd', 'RowHover', 'RowHoverSelected', 'Button'. Content is duplicate to Row.
Possible values: Content, Table, Header, Row, Footer, RowOdd, RowEven, RowSelected, RowSelectedEven, RowSelectedOdd, RowHover, RowHoverSelected, Button

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.