Cmdlet
ConvertFrom-OfficeRtf
Converts RTF input to Word, HTML, PDF, or Markdown output.
Syntax
ConvertFrom-OfficeRtf -As <Word|Html|Pdf|Markdown> [-ExcludeHeaderFooters] [-ExcludeImages] [-ExcludeNotes] [-ExcludeTables] [-FontFamily <String>] [-IncludeDefaultCss] [-IncludeFontStyles] [-IncludeHiddenText] [-IncludeListStyles] [-IncludeParagraphClasses] [-IncludeRunClasses] [-NoUnsupportedHtmlComments] [-OutputPath <String>] [-PassThru] [-Path] <String> [-UseImagePaths] [<CommonParameters>]#Parameter set:
PathConvertFrom-OfficeRtf -As <Word|Html|Pdf|Markdown> [-ExcludeHeaderFooters] [-ExcludeImages] [-ExcludeNotes] [-ExcludeTables] [-FontFamily <String>] [-IncludeDefaultCss] [-IncludeFontStyles] [-IncludeHiddenText] [-IncludeListStyles] [-IncludeParagraphClasses] [-IncludeRunClasses] [-NoUnsupportedHtmlComments] [-OutputPath <String>] [-PassThru] -Text <String> [-UseImagePaths] [<CommonParameters>]#Parameter set:
TextExamples
Convert RTF to Word.
New-OfficeRtf -Path .\Report.rtf -Text 'Summary', 'Ready for review'
ConvertFrom-OfficeRtf -Path .\Report.rtf -As Word -OutputPath .\Report.docx -PassThruLoads the RTF file and saves a Word document using OfficeIMO.Word.Rtf.
Convert RTF to HTML.
ConvertFrom-OfficeRtf -Path .\Report.rtf -As Html -OutputPath .\Report.htmlConverts RTF to Word, then serializes Word to HTML.
Convert RTF to PDF.
ConvertFrom-OfficeRtf -Path .\Report.rtf -As Pdf -OutputPath .\Report.pdfUses OfficeIMO.Rtf.Pdf to save a PDF file.
Convert RTF to Markdown.
ConvertFrom-OfficeRtf -Path .\Report.rtf -As Markdown -OutputPath .\Report.md -PassThruConverts the RTF document to Markdown using OfficeIMO.Rtf.Markdown.
Parameters
- -As OfficeRtfConversionTarget
- Target document format.
- Possible values:
Word,Html,Pdf,Markdown - Exclude RTF headers and footers from PDF output.
- -ExcludeImages SwitchParameter
- Exclude RTF images from PDF output.
- -ExcludeNotes SwitchParameter
- Exclude RTF notes from PDF output.
- -ExcludeTables SwitchParameter
- Exclude RTF tables from PDF output.
- -FontFamily String
- Optional font family for RTF to HTML conversion.
- -IncludeDefaultCss SwitchParameter
- Include the built-in default CSS for RTF to HTML conversion.
- -IncludeFontStyles SwitchParameter
- Include font styles as inline CSS for RTF to HTML conversion.
- Include hidden RTF text when converting to PDF or Markdown.
- -IncludeListStyles SwitchParameter
- Include list style metadata for RTF to HTML conversion.
- -IncludeParagraphClasses SwitchParameter
- Emit paragraph styles as CSS classes for RTF to HTML conversion.
- -IncludeRunClasses SwitchParameter
- Emit run styles as CSS classes for RTF to HTML conversion.
- -NoUnsupportedHtmlComments SwitchParameter
- Do not emit HTML comments for unsupported RTF features when converting to Markdown.
- -OutputPath String
- Optional output path. When omitted, the converted object or text is returned.
- -PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- -Path String
- RTF file path.
- -UseImagePaths SwitchParameter
- Store image references as file paths instead of base64 data URIs for HTML output.
- -Text String
- Raw RTF text.
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.