Project

PSWriteHTML

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

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

New-TableContent

Module PSWriteHTML

Provide a way to style or overwrite the table content with new content or style

Syntax

New-TableContent [[-Alignment] <left|center|right|justify>] [[-BackGroundColor] <String>] [[-Color] <String>] [[-ColumnIndex] <Int32[]>] [[-ColumnName] <String[]>] [[-Direction] <rtl|ltr>] [[-FontFamily] <String>] [[-FontSize] <Object>] [[-FontStyle] <normal|italic|oblique>] [[-FontVariant] <normal|small-caps>] [[-FontWeight] <String>] [[-RowIndex] <Int32[]>] [[-Text] <String[]>] [[-TextDecoration] <line-through|overline|underline>] [[-TextTransform] <uppercase|lowercase|capitalize>] [[-WordBreak] <normal|break-all|keep-all|break-word>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

Authored help example

EXAMPLE 1

New-HTML -TitleText "Example37 - Word Breaking" -FilePath "$PSScriptRoot\Example37.html" {
    New-HTMLSection -HeaderText "Word Break for whole table" -HeaderTextAlignment center -Content {
        New-HTMLTable -DataTable $(Get-Process | Select-Object -First 5) -WordBreak 'break-word'
    }
    New-HTMLSection -HeaderText "Word Break per column" -HeaderTextAlignment center -Content {
        New-HTMLTable -DataTable $(Get-Process | Select-Object -First 5) {
            New-TableContent -WordBreak break-all -ColumnName 'Path'
        }
    }
    New-HTMLSection -HeaderText "No word break" -HeaderTextAlignment center -Content {
        New-HTMLTable -DataTable $(Get-Process | Select-Object -First 5)
    }
} -Online -ShowHTML

EXAMPLE 2

$Values = @(
    [PSCustomObject] @{
        Test1 = 1
        Test2 = 2
        Test3 = 3
        Test4 = 1
    }
    [PSCustomObject] @{
        Test1 = 1
        Test2 = 2
        Test3 = 3
        Test4 = 1
    }
    [PSCustomObject] @{
        Test1 = 1
        Test2 = 2
        Test3 = 3
        Test4 = 2
    }
    [PSCustomObject] @{
        Test1 = 1
        Test2 = 2
        Test3 = 3
        Test4 = 1
    }
    [PSCustomObject] @{
        Test1 = 1
        Test2 = 2
        Test3 = 3
        Test4 = 1
    }
    [PSCustomObject] @{
        Test1 = 1
        Test2 = 2
        Test3 = 3
        Test4 = 2
    }
)

New-HTML -TitleText "Example41 - Table" -FilePath "$PSScriptRoot\Example41.html" { New-HTMLSection -HeaderText "Testing" -HeaderTextAlignment center -Content { New-HTMLTable -DataTable $Values { for ($i = 0; $i -le $Values.Count; $i++) { if ($Values[$i].Test1 -ne $Values[$i].Test4) { New-TableContent -BackGroundColor Red -ColumnName 'Test4' -RowIndex ($i+1) } } } } } -Online -ShowHTML

Parameters

-Alignment String optionalposition: 11
Provide new alignment. When skipped the alignment will not be changed. Options are: 'left', 'center', 'right', 'justify'
Possible values: left, center, right, justify
-BackGroundColor String optionalposition: 5
Pick one of the 800 colors or provide a hex color code.
-Color String optionalposition: 4
Pick one of the 800 colors or provide a hex color code.
-ColumnIndex Int32[] optionalposition: 1
Define column index to search where to replace the content or style. Conflicts with ColumnName. Choose one or the other.
-ColumnName String[] optionalposition: 0aliases: ColumnNames, Name, Names
Define column name to search where to replace the content or style. Conflicts with ColumnIndex. Choose one or the other.
-Direction String optionalposition: 14
Provide new direction. When skipped the direction will not be changed. Options are: 'rtl','ltr'. By default it's 'ltr'.
Possible values: rtl, ltr
-FontFamily String optionalposition: 10
Provide new font family. When skipped the font family will not be changed.
-FontSize Object optionalposition: 6
Provide new font size. When skipped the font size will not be changed.
-FontStyle String optionalposition: 8
Provide new font style. When skipped the font style will not be changed. Options are: 'normal', 'italic', 'oblique'
Possible values: normal, italic, oblique
-FontVariant String optionalposition: 9
Provide new font variant. When skipped the font variant will not be changed. Options are: 'normal', 'small-caps'
Possible values: normal, small-caps
-FontWeight String optionalposition: 7
Provide new font weight. When skipped the font weight will not be changed. Options are: '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
-RowIndex Int32[] optionalposition: 2
Define row index to search where to replace the content or style.
-Text String[] optionalposition: 3
Overwrite the text content of the cell. If not defined the cell will be styled only.
-TextDecoration String optionalposition: 12
Provide new text decoration. When skipped the text decoration will not be changed. Options are: 'none', 'line-through', 'overline', 'underline'
Possible values: line-through, overline, underline
-TextTransform String optionalposition: 13
Provide new text transform. When skipped the text transform will not be changed. Options are: 'uppercase', 'lowercase', 'capitalize'
Possible values: uppercase, lowercase, capitalize
-WordBreak String optionalposition: 15
Provide new word break. When skipped the word break will not be changed. Options are: 'normal', 'break-all', 'keep-all', 'break-word'
Possible values: normal, break-all, keep-all, break-word

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.