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

Namespace PSWriteHTML

Defines the body HTML content. By default this is not required, but can be useful when header and footer are used to explicitly define the main content.

Remarks

Defines the body HTML content. By default this is not required, but can be useful when header and footer are used to explicitly define the main content.

Examples

Authored help example

EXAMPLE 1


New-HTML -TitleText 'My title' -Online -FilePath $PSScriptRoot\Example40-Body.html -Show {
    New-HTMLMain {
        New-HTMLTabStyle -SlimTabs `
            -BorderBottomStyleActive solid -BorderBottomColorActive LightSkyBlue -BackgroundColorActive none `
            -TextColorActive Black -Align left -BorderRadius 0px -RemoveShadow -TextColor Grey -TextTransform capitalize #-FontSize 10pt
        

New-HTMLSectionStyle -BorderRadius 0px -HeaderBackGroundColor Grey New-HTMLTab -Name 'First Level Tab - Test 1' -IconBrands acquisitions-incorporated { New-HTMLTab -Name '2nd Level Tab - Test 4/1' -IconBrands app-store { New-HTMLSection -HeaderText 'Default Section Style' { New-HTMLTableStyle -Type Header -TextAlign right -TextColor Blue New-HTMLTableStyle -Type Row -TextAlign left -TextColor Grey New-HTMLTable -DataTable $Test1 { New-HTMLTableHeader -Names 'ID', 'HandleCount' } -Filtering #-HideFooter -FilteringLocation Both } -CanCollapse } } New-HTMLTab -Name 'Next' {

} } -BackgroundColor Yellow -Color Red -FontSize 12px #-FontFamily 'Arial' }

EXAMPLE 2


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
        

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-HTMLMain [-BackgroundColor <String>] [-Color <String>] [-FontFamily <String>] [-FontSize <Object>] [-HTMLContent <ScriptBlock>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

BackgroundColor String optionalposition: 1pipeline: False
Define a background color of the body element. You can choose from 800 defined colors or provide your own hex color
Color String optionalposition: 2pipeline: False
Choose a color of the body element. You can choose from 800 defined colors or provide your own hex color
FontFamily String optionalposition: 3pipeline: False
Choose a FontFamily for the body content
FontSize Object optionalposition: 4pipeline: False
Choose a FontSize for the body content
HTMLContent ScriptBlock optionalposition: 0pipeline: False
Provides ability to specify one or more elements within HTML. Using New-HTMLMain without it, makes no larger sense, as the content will be empty.