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

Namespace PSWriteHTML

This function provides ability to add new text to the HTML file.

Remarks

This function provides ability to add new text to the HTML file, with colors, fonts and other styling features. It is used to add text to the HTML file with proper styling and formatting. Please keep in mind that if parameter is not provided the defaults will be used. The defaults can be from the body itself, or from section or other parts of HTML depending on where the text is added.

Examples

Authored help example

EXAMPLE 1


New-HTML -TitleText 'This is a test' -FilePath "$PSScriptRoot\Example34_01.html" {
    New-HTMLHeader {
        New-HTMLText -Text "Date of this report $(Get-Date)" -Color Blue -Alignment right
    }
    New-HTMLMain {
        New-HTMLTab -TabName 'Test' {
            New-HTMLSection -HeaderText '0 section' {
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter
                }
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter
                }
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter -Simplify
                }
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter
                }
            }
        }
        New-HTMLTab -TabName 'Test5' {
            New-HTMLSection -HeaderText '1 section' {
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter
                }
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter
                    # New-HTMLTable -DataTable $Processes -HideFooter
                }
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Processes -HideFooter
                }
            }
        }
    }
    New-HTMLFooter {
        New-HTMLText -Text "Date of this report $(Get-Date)" -Color Blue -Alignment right
    }
} -Online -ShowHTML
        

EXAMPLE 2

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-HTMLText [-Alignment <left|center|right|justify>] [-BackGroundColor <String[]>] [-Color <String[]>] [-Direction <rtl|ltr>] [-Display <inline>] [-FontFamily <String[]>] [-FontSize <Object[]>] [-FontStyle <normal|italic|oblique>] [-FontVariant <normal|small-caps>] [-FontWeight <normal>] [-LineBreak] [-LineHeight <String[]>] [-Opacity <Double[]>] [-SkipParagraph] [-Text <String[]>] [-TextBlock <ScriptBlock>] [-TextDecoration <line-through|overline|underline>] [-TextTransform <uppercase|lowercase|capitalize>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Alignment String[] optionalposition: namedpipeline: Falsevalues: 4
Provide alignment. When skipped the default alignment will be used. Options are: 'left', 'right', 'center', 'justify'
Possible values: left, center, right, justify
BackGroundColor String[] optionalposition: namedpipeline: False
Pick one of the 800 colors or provide a hex color code.
Color String[] optionalposition: namedpipeline: False
Pick one of the 800 colors or provide a hex color code.
Direction String[] optionalposition: namedpipeline: Falsevalues: 2
Provide direction. When skipped the direction will not be changed. Options are: 'rtl','ltr'. By default it's 'ltr'.
Possible values: rtl, ltr
Display String[] optionalposition: namedpipeline: Falsevalues: 20
Allows configuring CSS display property. The display property specifies the display behavior (the type of rendering box) of an element. Options are: 'none', 'inline', 'block', 'inline-block', 'contents','flex', 'grid', 'inline-flex', 'inline-grid', 'inline-table', 'list-item', 'run-in', 'table', 'table-caption', 'table-column-group', 'table-header-group', 'table-footer-group', 'table-row-group', 'table-cell', 'table-column', 'table-row'
Possible values: inline, block, inline-block, contents, flex, grid, inline-flex, inline-grid, inline-table, list-item, run-in, table, table-caption, table-column-group, table-header-group, table-footer-group, table-row-group, table-cell, table-column, table-row
FontFamily String[] optionalposition: namedpipeline: False
Provide font family. When skipped the default font family will be used.
FontSize Object[] optionalposition: namedpipeline: Falsealiases: Size
Provide font size. When skipped the default font size will be used.
FontStyle String[] optionalposition: namedpipeline: Falsevalues: 3
Provide font style. When skipped the default font style will be used. Options are: 'normal', 'italic', 'oblique'
Possible values: normal, italic, oblique
FontVariant String[] optionalposition: namedpipeline: Falsevalues: 2
Provide font variant. When skipped the default font variant will be used. Options are: 'normal', 'small-caps'
Possible values: normal, small-caps
FontWeight String[] optionalposition: namedpipeline: Falsevalues: 13
Provide font weight. When skipped the default font weight will be used. 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
LineBreak SwitchParameter optionalposition: namedpipeline: False
Decides whether to add line break at the end of the text or not.
LineHeight String[] optionalposition: namedpipeline: False
Provide line height. When skipped the default line height will be used.
Opacity Double[] optionalposition: namedpipeline: False
The opacity property sets the opacity level for an element. Value between 0 and 1. 1 is default.
SkipParagraph SwitchParameter optionalposition: namedpipeline: False
Skips adding div tag to make sure text is not wrapped in it. By default it wraps all text in div tag.
Text String[] optionalposition: namedpipeline: False
Provide text or text array to be added to the HTML file.
TextBlock ScriptBlock optionalposition: 0pipeline: False
Defines ability to use text block instead of array
TextDecoration String[] optionalposition: namedpipeline: Falsevalues: 3
Provide text decoration. When skipped the default text decoration will be used. Options are: 'none', 'line-through', 'overline', 'underline'
Possible values: line-through, overline, underline
TextTransform String[] optionalposition: namedpipeline: Falsevalues: 3
Provide text transform. When skipped the default text transform will be used. Options are: 'uppercase', 'lowercase', 'capitalize'
Possible values: uppercase, lowercase, capitalize