# Update-OfficeRtfText

Applies lossless text and metadata edits to an RTF document.

Project

PSWriteOffice

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

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: Replace-OfficeRtfText, RtfText

**Module**

`PSWriteOffice`

**Aliases**

`Replace-OfficeRtfText` `RtfText`

**Inputs**

`System.String`

**Outputs**

`System.IO.FileInfo`

**Source**

[UpdateOfficeRtfTextCommand.cs:22](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Rtf/UpdateOfficeRtfTextCommand.cs#L22) 

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>]
```

[#](#method-update-officertftext-string-switchparameter-idictionary-idictionary-string-string-string-switchparameter-string-idictionary)

Parameter set: `All Parameter Sets`

## Examples

### Replace text in an RTF file.

```powershell
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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:DD79BAA8DC2A0F96EE61AF32F602C21D0056F5010646C9B5684AECDDBFFDF0BC -->
