API Reference
Cmdlet
ConvertFrom-OfficeWordHtml
Creates a Word document from HTML.
Remarks
Returns a WordDocument or saves it to disk when -OutputPath is provided.
Examples
Create a .docx from HTML markup.
PS>
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.
PS>
$doc = ConvertFrom-OfficeWordHtml -Path .\snippet.html
Returns a Word document instance for further edits.
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
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:
HtmlParameters
- BasePath String
- Base path used to resolve relative resources (for example images).
- ContinueNumbering SwitchParameter
- Continue numbering across separate ordered lists.
- FontFamily String
- Optional font family to apply during conversion.
- Html String
- HTML markup to convert.
- IncludeListStyles SwitchParameter
- Include list style metadata.
- Open SwitchParameter
- Open the document after saving.
- OutputPath String
- Optional output path for the .docx file.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- RenderPreAsTable SwitchParameter
- Render <pre> elements as single-cell tables.
- SectionTagHandling SectionTagHandling
- Controls how <section> tags are mapped into Word.
- Possible values:
WordSection,Block - StylesheetContent String[]
- Inline CSS stylesheets to apply during conversion.
- StylesheetPath String[]
- Paths to CSS stylesheets to apply during conversion.
- SupportsHeadingNumbering SwitchParameter
- Convert headings into a numbered list.
- TableCaptionPosition TableCaptionPosition
- Controls where table captions are emitted.
- Possible values:
Above,Below
Outputs
OfficeIMO.Word.WordDocument, System.IO.FileInfo
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:
PathParameters
- BasePath String
- Base path used to resolve relative resources (for example images).
- ContinueNumbering SwitchParameter
- Continue numbering across separate ordered lists.
- FontFamily String
- Optional font family to apply during conversion.
- IncludeListStyles SwitchParameter
- Include list style metadata.
- Open SwitchParameter
- Open the document after saving.
- OutputPath String
- Optional output path for the .docx file.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- Path String
- Path to an HTML file.
- RenderPreAsTable SwitchParameter
- Render <pre> elements as single-cell tables.
- SectionTagHandling SectionTagHandling
- Controls how <section> tags are mapped into Word.
- Possible values:
WordSection,Block - StylesheetContent String[]
- Inline CSS stylesheets to apply during conversion.
- StylesheetPath String[]
- Paths to CSS stylesheets to apply during conversion.
- SupportsHeadingNumbering SwitchParameter
- Convert headings into a numbered list.
- TableCaptionPosition TableCaptionPosition
- Controls where table captions are emitted.
- Possible values:
Above,Below
Outputs
OfficeIMO.Word.WordDocument, System.IO.FileInfo