Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
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

Authored help example

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.