# New-HTMLTextBox

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

Project

PSWriteHTML

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

[View on GitHub](https://github.com/EvotecIT/PSWriteHTML) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteHTML/releases/tag/v1.41.0) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteHTML/1.40.0)

Stars **1,025**

Forks **114**

Open issues 

PowerShell Gallery downloads **7,576,901**

Release **v1.45.0**

Language: PowerShell Updated: 2026-11-19

Command 

**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>]
```

[#](#method-new-htmltextbox-string-string-string-string-string-int32-string-string-string-switchparameter-scriptblock-string-string)

Parameter set: `All Parameter Sets`

## Description

. 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

### Example 1

```powershell
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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:5B86A78A4429E94689EDB361E904E6C723BCCDCF9E68AD568F24C08E6C6B9193 -->
