API Reference
ConvertTo-OfficeRtf
Converts Word, HTML, PDF, or Markdown input to RTF.
Remarks
Converts Word, HTML, PDF, or Markdown input to RTF.
Examples
Convert Word to RTF.
PS>
New-OfficeWord -Path .\Report.docx { WordParagraph -Text 'Summary' }
ConvertTo-OfficeRtf -WordPath .\Report.docx -OutputPath .\Report.rtf -PassThru
Loads the Word document and saves an RTF file using OfficeIMO.Word.Rtf.
Convert HTML to RTF.
PS>
ConvertTo-OfficeRtf -Html '<h1>Report</h1>' -OutputPath .\Report.rtf
Creates a Word document from HTML and serializes it to RTF.
Convert PDF to RTF.
PS>
ConvertTo-OfficeRtf -PdfPath .\Report.pdf -OutputPath .\Report.rtf
Uses OfficeIMO.Rtf.Pdf's semantic PDF reader to write RTF output.
Convert Markdown to RTF.
PS>
ConvertTo-OfficeRtf -MarkdownPath .\Report.md -OutputPath .\Report.rtf -PassThru
Parses Markdown and writes RTF using OfficeIMO.Rtf.Markdown.
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
ConvertTo-OfficeRtf [-OutputPath <String>] [-PassThru] -WordPath <String> [<CommonParameters>]#WordPathParameters
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- WordPath String
- Path to a .docx file to convert to RTF.
Outputs
System.String System.IO.FileInfo
ConvertTo-OfficeRtf [-OutputPath <String>] [-PassThru] -WordDocument <WordDocument> [<CommonParameters>]#WordDocumentParameters
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- WordDocument WordDocument
- Word document instance to convert to RTF.
Outputs
System.String System.IO.FileInfo
ConvertTo-OfficeRtf [-BasePath <String>] [-FontFamily <String>] -Html <String> [-OutputPath <String>] [-PassThru] [-StylesheetContent <String[]>] [-StylesheetPath <String[]>] [<CommonParameters>]#HtmlParameters
- BasePath String
- Base path used to resolve relative HTML resources.
- FontFamily String
- Optional font family for HTML to Word conversion before RTF serialization.
- Html String
- HTML markup to convert to RTF through the Word HTML converter.
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- StylesheetContent String[]
- Inline CSS stylesheets to apply during HTML conversion.
- StylesheetPath String[]
- Paths to CSS stylesheets to apply during HTML conversion.
Outputs
System.String System.IO.FileInfo
ConvertTo-OfficeRtf [-BasePath <String>] [-FontFamily <String>] -HtmlPath <String> [-OutputPath <String>] [-PassThru] [-StylesheetContent <String[]>] [-StylesheetPath <String[]>] [<CommonParameters>]#HtmlPathParameters
- BasePath String
- Base path used to resolve relative HTML resources.
- FontFamily String
- Optional font family for HTML to Word conversion before RTF serialization.
- HtmlPath String
- Path to an HTML file to convert to RTF.
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- StylesheetContent String[]
- Inline CSS stylesheets to apply during HTML conversion.
- StylesheetPath String[]
- Paths to CSS stylesheets to apply during HTML conversion.
Outputs
System.String System.IO.FileInfo
ConvertTo-OfficeRtf [-OutputPath <String>] [-PassThru] -PdfPath <String> [<CommonParameters>]#PdfPathParameters
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- PdfPath String
- Path to a PDF file to convert to semantic RTF.
Outputs
System.String System.IO.FileInfo
ConvertTo-OfficeRtf -Markdown <String> [-OutputPath <String>] [-PassThru] [-PreserveRawHtmlAsText] [<CommonParameters>]#MarkdownParameters
- Markdown String
- Markdown text to convert to RTF.
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- PreserveRawHtmlAsText SwitchParameter
- Preserve raw HTML Markdown blocks as plain text in the RTF output.
Outputs
System.String System.IO.FileInfo
ConvertTo-OfficeRtf -MarkdownPath <String> [-OutputPath <String>] [-PassThru] [-PreserveRawHtmlAsText] [<CommonParameters>]#MarkdownPathParameters
- MarkdownPath String
- Path to a Markdown file to convert to RTF.
- OutputPath String
- Optional destination RTF path. When omitted, raw RTF text is returned.
- PassThru SwitchParameter
- Emit a FileInfo when saving to disk.
- PreserveRawHtmlAsText SwitchParameter
- Preserve raw HTML Markdown blocks as plain text in the RTF output.
Outputs
System.String System.IO.FileInfo