API Reference
New-TableContent
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
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>]
#
All Parameter SetsParameters
- Alignment String
- 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
- Pick one of the 800 colors or provide a hex color code.
- Color String
- Pick one of the 800 colors or provide a hex color code.
- ColumnIndex Int32[]
- Define column index to search where to replace the content or style. Conflicts with ColumnName. Choose one or the other.
- ColumnName String[]
- Define column name to search where to replace the content or style. Conflicts with ColumnIndex. Choose one or the other.
- Direction String
- 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
- Provide new font family. When skipped the font family will not be changed.
- FontSize Object
- Provide new font size. When skipped the font size will not be changed.
- FontStyle String
- 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
- 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
- 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[]
- Define row index to search where to replace the content or style.
- Text String[]
- Overwrite the text content of the cell. If not defined the cell will be styled only.
- TextDecoration String
- 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
- 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
- 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