Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

ConvertFrom-OfficeRtf

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

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: Path
ConvertFrom-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: Text

Examples

Authored help example

Convert RTF to Word.

New-OfficeRtf -Path .\Report.rtf -Text 'Summary', 'Ready for review'
ConvertFrom-OfficeRtf -Path .\Report.rtf -As Word -OutputPath .\Report.docx -PassThru

Loads 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.html

Converts RTF to Word, then serializes Word to HTML.

Convert RTF to PDF.

ConvertFrom-OfficeRtf -Path .\Report.rtf -As Pdf -OutputPath .\Report.pdf

Uses OfficeIMO.Rtf.Pdf to save a PDF file.

Convert RTF to Markdown.

ConvertFrom-OfficeRtf -Path .\Report.rtf -As Markdown -OutputPath .\Report.md -PassThru

Converts the RTF document to Markdown using OfficeIMO.Rtf.Markdown.

Parameters

-As OfficeRtfConversionTarget required
Target document format.
Possible values: Word, Html, Pdf, Markdown
-ExcludeHeaderFooters SwitchParameter optional
Exclude RTF headers and footers from PDF output.
-ExcludeImages SwitchParameter optional
Exclude RTF images from PDF output.
-ExcludeNotes SwitchParameter optional
Exclude RTF notes from PDF output.
-ExcludeTables SwitchParameter optional
Exclude RTF tables from PDF output.
-FontFamily String optional
Optional font family for RTF to HTML conversion.
-IncludeDefaultCss SwitchParameter optional
Include the built-in default CSS for RTF to HTML conversion.
-IncludeFontStyles SwitchParameter optional
Include font styles as inline CSS for RTF to HTML conversion.
-IncludeHiddenText SwitchParameter optional
Include hidden RTF text when converting to PDF or Markdown.
-IncludeListStyles SwitchParameter optional
Include list style metadata for RTF to HTML conversion.
-IncludeParagraphClasses SwitchParameter optional
Emit paragraph styles as CSS classes for RTF to HTML conversion.
-IncludeRunClasses SwitchParameter optional
Emit run styles as CSS classes for RTF to HTML conversion.
-NoUnsupportedHtmlComments SwitchParameter optional
Do not emit HTML comments for unsupported RTF features when converting to Markdown.
-OutputPath String optionalaliases: OutPath
Optional output path. When omitted, the converted object or text is returned.
-PassThru SwitchParameter optional
Emit a FileInfo when saving to disk.
-Path String requiredposition: 0pipeline: True (ByValue)aliases: FilePathsets: Path
RTF file path.
-UseImagePaths SwitchParameter optional
Store image references as file paths instead of base64 data URIs for HTML output.
-Text String requiredsets: Text
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.