Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Update-OfficeRtfText

Aliases: Replace-OfficeRtfText, RtfText
Module
PSWriteOffice
Aliases
Replace-OfficeRtfText RtfText
Inputs
System.String
Outputs
System.IO.FileInfo

Applies lossless text and metadata edits to an RTF document.

Syntax

Update-OfficeRtfText
[-AppendParagraph <String[]>]
[-CaseInsensitive]
[-DocumentProperty <IDictionary>]
[-DocumentVariable <IDictionary>]
[-NewText <String>]
[-OldText <String>]
-OutputPath <String>
[-PassThru]
[-Path] <String>
[-UserProperty <IDictionary>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

Replace text in an RTF file.

New-OfficeRtf -Path .\Input.rtf -Text 'Status: Draft'
Update-OfficeRtfText -Path .\Input.rtf -OutputPath .\Output.rtf -OldText Draft -NewText Final -PassThru

Uses OfficeIMO.Rtf's lossless editor to update visible text while preserving untouched RTF syntax.

Parameters

-AppendParagraph String[] optional
Plain paragraphs to append to the end of the RTF document.
-CaseInsensitive SwitchParameter optional
Use ordinal case-insensitive text replacement.
-DocumentProperty IDictionary optional
Document info fields to set, such as Title, Author, Company, or Comments.
-DocumentVariable IDictionary optional
Document variables to set.
-NewText String optional
Replacement visible text.
-OldText String optional
Visible text to replace.
-OutputPath String required
Destination RTF file path.
-PassThru SwitchParameter optional
Emit a FileInfo for chaining.
-Path String requiredposition: 0pipeline: True (ByValue)aliases: FilePath
Source RTF file path.
-UserProperty IDictionary optional
Custom user properties to set.

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.