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-HTMLTextBox

Module PSWriteHTML

Adds text to HTML where each line in TextBlock is treated as next line (adds BR to each line)

Syntax

New-HTMLTextBox [-Alignment <left|center|right|justify>] [-BackGroundColor <String[]>] [-Color <String[]>] [-Direction <rtl>] [-FontFamily <String[]>] [-FontSize <Int32[]>] [-FontStyle <normal|italic|oblique>] [-FontVariant <normal|small-caps>] [-FontWeight <String[]>] [-LineBreak] [[-TextBlock] <ScriptBlock>] [-TextDecoration <line-through|overline|underline>] [-TextTransform <uppercase|lowercase|capitalize>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Adds text to HTML where each line in TextBlock is treated as next line (adds BR to each line). Automatic line breaks are main feature that differentiate New-HTMLTextBox from New-HTMLText where TextBlock is treated as single line of text unless LineBreak switch is used.

Examples

Authored help example

EXAMPLE 1

New-HTMLTextBox {
    "Hello $UserNotify,"
    ""
    "Your password is due to expire in $PasswordExpiryDays days."
    ""
    'To change your password: '
    '- press CTRL+ALT+DEL -> Change a password...'
    ''
    'If you have forgotten your password and need to reset it, you can do this by clicking here. '
    "In case of problems please contact the HelpDesk by visiting [Evotec Website](https://evotec.xyz) or by sending an email to Help Desk."
    ''
    'Alternatively you can always call Help Desk at +48 22 00 00 00'
    ''
    'Kind regards,'
    'Evotec IT'
}

Parameters

-Alignment String[] optional
Chhoose Alignment
Possible values: left, center, right, justify
-BackGroundColor String[] optional
Color of Background for a Text to set. Choose one or more colors from up to 800 defined colors. Alternatively provide your own Hex value
-Color String[] optional
Color of Text to set. Choose one or more colors from up to 800 defined colors. Alternatively provide your own Hex value
-Direction String[] optional
Parameter description
Possible values: rtl
-FontFamily String[] optional
Parameter description
-FontSize Int32[] optionalaliases: Size
Choose FontSize. You can provide just int value which will assume pixels or string value with any other size value.
-FontStyle String[] optional
Parameter description
Possible values: normal, italic, oblique
-FontVariant String[] optional
Parameter description
Possible values: normal, small-caps
-FontWeight String[] optional
Parameter description
Possible values: normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900
-LineBreak SwitchParameter optional
Parameter description
-TextBlock ScriptBlock optionalposition: 0
ScriptBlock of one or more strings
-TextDecoration String[] optional
Parameter description
Possible values: line-through, overline, underline
-TextTransform String[] optional
Parameter description
Possible values: uppercase, lowercase, capitalize

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.