Cmdlet
ConvertTo-OfficeWordHtml
Converts a Word document to HTML.
Syntax
ConvertTo-OfficeWordHtml
[-ExcludeFootnotes]
[-FontFamily <String>]
[-IncludeDefaultCss]
[-IncludeFontStyles]
[-IncludeListStyles]
[-IncludeParagraphClasses]
[-IncludeRunClasses]
[-OutputPath <String>]
[-PassThru]
[-Path] <String>
[-UseImagePaths]
[<CommonParameters>]#Parameter set:
PathConvertTo-OfficeWordHtml
-Document <WordDocument>
[-ExcludeFootnotes]
[-FontFamily <String>]
[-IncludeDefaultCss]
[-IncludeFontStyles]
[-IncludeListStyles]
[-IncludeParagraphClasses]
[-IncludeRunClasses]
[-OutputPath <String>]
[-PassThru]
[-UseImagePaths]
[<CommonParameters>]#Parameter set:
DocumentDescription
Returns the HTML string or saves it to a file when -OutputPath is specified.
Examples
Convert a .docx file to HTML text.
$html = ConvertTo-OfficeWordHtml -Path .\report.docxLoads the document and returns HTML markup.
Save HTML to disk.
ConvertTo-OfficeWordHtml -Path .\report.docx -OutputPath .\report.html -PassThruWrites report.html and returns the file info.
Parameters
- -ExcludeFootnotes SwitchParameter
- Exclude footnotes from the HTML output.
- -FontFamily String
- Optional font family to use during conversion.
- -IncludeDefaultCss SwitchParameter
- Include the built-in default CSS in the HTML head.
- -IncludeFontStyles SwitchParameter
- Include font styles as inline CSS.
- -IncludeListStyles SwitchParameter
- Include list style metadata.
- -IncludeParagraphClasses SwitchParameter
- Emit paragraph styles as CSS classes.
- -IncludeRunClasses SwitchParameter
- Emit run styles as CSS classes.
- -OutputPath String
- Optional output path for the HTML file.
- -PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- -Path String
- Path to a .docx file.
- -UseImagePaths SwitchParameter
- Store image references as file paths instead of base64 data URIs.
- -Document WordDocument
- Word document instance to convert.
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.