Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

ConvertFrom-OfficeWordHtml

Aliases: ConvertFrom-WordHtml
Module
PSWriteOffice
Aliases
ConvertFrom-WordHtml
Inputs
System.String
Outputs
OfficeIMO.Word.WordDocument System.IO.FileInfo

Creates a Word document from HTML.

Syntax

ConvertFrom-OfficeWordHtml
[-BasePath <String>]
[-ContinueNumbering]
[-FontFamily <String>]
[-Html] <String>
[-IncludeListStyles]
[-Open]
[-OutputPath <String>]
[-PassThru]
[-RenderPreAsTable]
[-SectionTagHandling <WordSection|Block>]
[-StylesheetContent <String[]>]
[-StylesheetPath <String[]>]
[-SupportsHeadingNumbering]
[-TableCaptionPosition <Above|Below>]
[<CommonParameters>]
#
Parameter set: Html
ConvertFrom-OfficeWordHtml
[-BasePath <String>]
[-ContinueNumbering]
[-FontFamily <String>]
[-IncludeListStyles]
[-Open]
[-OutputPath <String>]
[-PassThru]
[-Path] <String>
[-RenderPreAsTable]
[-SectionTagHandling <WordSection|Block>]
[-StylesheetContent <String[]>]
[-StylesheetPath <String[]>]
[-SupportsHeadingNumbering]
[-TableCaptionPosition <Above|Below>]
[<CommonParameters>]
#
Parameter set: Path

Description

Returns a WordDocument or saves it to disk when -OutputPath is provided.

Examples

Create a .docx from HTML markup.

ConvertFrom-OfficeWordHtml -Html '<h1>Hello</h1>' -OutputPath .\hello.docx

Writes a Word document containing the supplied HTML.

Load HTML from disk and get the document object.

$doc = ConvertFrom-OfficeWordHtml -Path .\snippet.html

Returns a Word document instance for further edits.

Parameters

-BasePath String optional
Base path used to resolve relative resources (for example images).
-ContinueNumbering SwitchParameter optional
Continue numbering across separate ordered lists.
-FontFamily String optional
Optional font family to apply during conversion.
-Html String requiredposition: 0pipeline: True (ByValue)sets: Html
HTML markup to convert.
-IncludeListStyles SwitchParameter optional
Include list style metadata.
-Open SwitchParameter optional
Open the document after saving.
-OutputPath String optionalaliases: OutPath
Optional output path for the .docx file.
-PassThru SwitchParameter optional
Emit a FileInfo when saving to disk.
-RenderPreAsTable SwitchParameter optional
Render <pre> elements as single-cell tables.
-SectionTagHandling SectionTagHandling optional
Controls how <section> tags are mapped into Word.
Possible values: WordSection, Block
-StylesheetContent String[] optional
Inline CSS stylesheets to apply during conversion.
-StylesheetPath String[] optional
Paths to CSS stylesheets to apply during conversion.
-SupportsHeadingNumbering SwitchParameter optional
Convert headings into a numbered list.
-TableCaptionPosition TableCaptionPosition optional
Controls where table captions are emitted.
Possible values: Above, Below
-Path String requiredposition: 0aliases: FilePathsets: Path
Path to an HTML file.

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.