Cmdlet
ConvertFrom-OfficeWordHtml
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:
HtmlConvertFrom-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:
PathDescription
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.docxWrites a Word document containing the supplied HTML.
Load HTML from disk and get the document object.
$doc = ConvertFrom-OfficeWordHtml -Path .\snippet.htmlReturns a Word document instance for further edits.
Parameters
- -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 - -Path String
- 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.