# New-HTMLMain

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.

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`

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.

## Syntax

```
New-HTMLMain
[[-BackgroundColor] <String>]
[[-Color] <String>]
[[-FontFamily] <String>]
[[-FontSize] <Object>]
[[-HTMLContent] <ScriptBlock>]
[<CommonParameters>]
```

[#](#method-new-htmlmain-string-string-string-object-scriptblock)

Parameter set: `All Parameter Sets`

## Examples

### Example 1

```powershell
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

```powershell
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
```

## Parameters

**-BackgroundColor String optionalposition: 1**

Define a background color of the body element. You can choose from 800 defined colors or provide your own hex color

**-Color String optionalposition: 2**

Choose a color of the body element. You can choose from 800 defined colors or provide your own hex color

**-FontFamily String optionalposition: 3**

Choose a FontFamily for the body content

**-FontSize Object optionalposition: 4**

Choose a FontSize for the body content

**-HTMLContent ScriptBlock optionalposition: 0**

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.

## 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:0BABFA00AD62ECBADD4FA4E3FC3C5B48B5169950B5A5C6A3703F8E2C83D967B4 -->
