# New-HTML

Building block for creating HTML elements. A starting point for all other cmdlets in PSWriteHTML except Out-HtmlView.

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`

Building block for creating HTML elements. A starting point for all other cmdlets in PSWriteHTML except Out-HtmlView.

## Syntax

```
New-HTML
[-AddComment]
[-Author <String>]
[-AutoRefresh <Int32>]
[-DateFormat <String>]
[-Encoding <Object>]
[-FavIcon <Uri>]
[-FilePath <String>]
[-Format]
[[-HtmlData] <ScriptBlock>]
[-Language <String>]
[-Minify]
[-Online]
[-ShowHTML]
[-Temporary]
[-TitleText <String>]
[-UseCssLinks]
[-UseJavaScriptLinks]
[<CommonParameters>]
```

[#](#member-10cc2748c0814a578c98a50e)

Parameter set: `All Parameter Sets`

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [PSWriteHTML project overview](/projects/pswritehtml/docs/overview/) Guide
  
  A project-level starting point for using PSWriteHTML in reports, dashboards, and HTML automation.

## Examples

### Example 1

```powershell
New-HTML {
    New-HTMLSection -HeaderText 'Donut Charts - Defaults' -CanCollapse {
        New-HTMLPanel {
            New-HTMLChart {
                New-ChartToolbar -Download
                #New-ChartBarOptions -Gradient
                New-ChartLegend -Name 'Time', 'Money', 'Taxes', 'test'
                New-ChartBar -Name 'Test' -Value 1, 2, 3, 0
                New-ChartBar -Name 'Test1' -Value 2, 5, 7, 0
                New-ChartBar -Name 'Test2' -Value 3, 1, 50, 5
            }
        }
        New-HTMLPanel {
            New-HTMLChart {
                New-ChartToolbar -Download
                #New-ChartBarOptions -Gradient
                New-ChartLegend -Name 'Time', 'Money', 'Taxes' -Color Red, Yellow, Green
                New-ChartBar -Name 'Test' -Value 1, 2, 3
                New-ChartBar -Name 'Test1' -Value 2, 5, 7
                New-ChartBar -Name 'Test2' -Value 3, 1, 2
            }
        }
        New-HTMLPanel {
            New-HTMLChart {
                New-ChartToolbar -Download
                New-ChartBarOptions -Type barStacked
                New-ChartLegend -Name 'Time', 'Money', 'Taxes' -Color Red, Yellow, Green
                New-ChartBar -Name 'Test' -Value 1, 2, 3
                New-ChartBar -Name 'Test1' -Value 2, 5, 7
                New-ChartBar -Name 'Test2' -Value 3, 1, 2
            }
        }
    }
} -ShowHTML -FilePath $PSScriptRoot\Example-ChartBarNext.html -Online -Format
```

### Example 2

```powershell
New-HTML -TitleText "Testing HideButtons" -Online -FilePath "$PSScriptRoot\Example7_06.html" {
    # Hide Buttons
    New-HTMLSection -HeaderText "Hide Buttons" -Content {
        New-HTMLTable -DataTable $Table -HideButtons
    }
    New-HTMLSection -Invisible {
        New-HTMLSection -HeaderText "Hide Buttons" -Content {
            New-HTMLTable -DataTable $Table -HideButtons -Transpose
        }
        New-HTMLSection -HeaderText 'Some chart' {
            New-HTMLChart {
                New-ChartPie -Name 'Passed' -Value 5 -Color $ColorPassed
                New-ChartPie -Name 'Failed' -Value 10 -Color $ColorFailed
                New-ChartPie -Name 'Skipped' -Value 15 -Color $ColorSkipped
            }
        }
    }
    New-HTMLSection -HeaderText "Code used to generate above tables" -Content {
        New-HTMLCodeBlock {
            New-HTMLSection -HeaderText "Hide Buttons" -Content {
                New-HTMLTable -DataTable $Table -HideButtons
            }
```

New-HTMLSection -Invisible { New-HTMLSection -HeaderText "Hide Buttons" -Content { New-HTMLTable -DataTable $Table -HideButtons -Transpose } New-HTMLSection -HeaderText 'Some chart' { New-HTMLChart { New-ChartPie -Name 'Passed' -Value 5 -Color $ColorPassed New-ChartPie -Name 'Failed' -Value 10 -Color $ColorFailed New-ChartPie -Name 'Skipped' -Value 15 -Color $ColorSkipped } } } } } } -ShowHTML

## Parameters

**-AddComment SwitchParameter optional**

Adds additional commands to the generated HTML file. This is useful for tracking or knowing what is what.

**-Author String optional**

Defines the author information in the HTML file (meta information). If not specified, the author information is skipped.

**-AutoRefresh Int32 optional**

Defines if the page should be refreshed automatically every X seconds.

**-DateFormat String optional**

Defines the date format in the HTML file (meta information). Default is 'yyyy-MM-dd HH:mm:ss'

**-Encoding Object optional**

Provides ability to choose encoding of the HTML file. Not really required to use, as UTF8 is the default. Options available: 'Unknown', 'String', 'Unicode', 'Byte', 'BigEndianUnicode', 'UTF8', 'UTF7', 'UTF32', 'Ascii', 'Default', 'Oem', 'BigEndianUTF32'

Possible values: `Unknown`, `String`, `Unicode`, `Byte`, `BigEndianUnicode`, `UTF8`, `UTF7`, `UTF32`, `Ascii`, `Default`, `Oem`, `BigEndianUTF32`

**-FavIcon Uri optional**

Provides ability to add a favicon to the HTML page. Can be a link or file path

**-FilePath String optional**

Provides the path to the file to be created.

**-Format SwitchParameter optional**

Formats HTML output (including CSS/JS). Requires PSParseHTML to be installed and available.

**-HtmlData ScriptBlock optionalposition: 0aliases: Content**

Provides ability to specify one or more elements within HTML. Using New-HTML without it, makes no larger sense.

**-Language String optional**

**-Minify SwitchParameter optional**

Minifies HTML output (including CSS/JS). Requires PSParseHTML to be installed and available.

**-Online SwitchParameter optional**

Enables or Disables linking of CSS/JS. When Online is enabled that means that the CSS/JS files are loaded from the CDN. When Online is disabled that means that the CSS/JS files are all loaded from same HTML file (making it very large).

**-ShowHTML SwitchParameter optionalaliases: Open, Show**

Opens HTML in browser when generating of HTML is done. When no filepath is provided it uses temporary path instead. Good for testing.

**-Temporary SwitchParameter optional**

Forces use of temporary file name. Doesn't work with -FilePath parameter.

**-TitleText String optionalaliases: Name, Title**

Title of the HTML page

**-UseCssLinks SwitchParameter optional**

Deprecated - will be removed

**-UseJavaScriptLinks SwitchParameter optional**

## 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:BED88BF1CC5575E9140CDFD18FD048FC4B9AE09875818F53C284F44FCDE6D645 -->
