Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

New-TableContent

Aliases: New-HTMLTableContent
Namespace PSWriteHTML
Aliases
New-HTMLTableContent

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

Remarks

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

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

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.

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 <normal>] [-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

Parameters

Alignment String optionalposition: 11pipeline: Falsevalues: 4
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: 5pipeline: False
Pick one of the 800 colors or provide a hex color code.
Color String optionalposition: 4pipeline: False
Pick one of the 800 colors or provide a hex color code.
ColumnIndex Int32[] optionalposition: 1pipeline: False
Define column index to search where to replace the content or style. Conflicts with ColumnName. Choose one or the other.
ColumnName String[] optionalposition: 0pipeline: Falsealiases: 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: 14pipeline: Falsevalues: 2
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: 10pipeline: False
Provide new font family. When skipped the font family will not be changed.
FontSize Object optionalposition: 6pipeline: False
Provide new font size. When skipped the font size will not be changed.
FontStyle String optionalposition: 8pipeline: Falsevalues: 3
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: 9pipeline: Falsevalues: 2
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: 7pipeline: Falsevalues: 13
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: 2pipeline: False
Define row index to search where to replace the content or style.
Text String[] optionalposition: 3pipeline: False
Overwrite the text content of the cell. If not defined the cell will be styled only.
TextDecoration String optionalposition: 12pipeline: Falsevalues: 3
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: 13pipeline: Falsevalues: 3
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: 15pipeline: Falsevalues: 4
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