# Update-OfficeRtfText

Applies lossless text and metadata edits to an RTF document.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`System.String`

**Outputs**

`System.IO.FileInfo`

**Source**

[UpdateOfficeRtfTextCommand.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Rtf/UpdateOfficeRtfTextCommand.cs#L20) 

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>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

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

Parameter set: `Path`

```
Update-OfficeRtfText
[-AppendParagraph <String[]>]
[-CaseInsensitive]
[-DocumentProperty <IDictionary>]
[-DocumentVariable <IDictionary>]
-LiteralPath <String>
[-NewText <String>]
[-OldText <String>]
-OutputPath <String>
[-PassThru]
[-UserProperty <IDictionary>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

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

Parameter set: `LiteralPath`

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Create and Edit RTF Documents](/docs/rtf/) Guide
  
  Create Rich Text Format (RTF) files in .NET, edit text and bookmarks, merge documents, apply a theme, and make surgical edits that keep the original RTF syntax.

## 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: FilePathsets: Path**

Source RTF file path.

**-UserProperty IDictionary optional**

Custom user properties to set.

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

Prompts for confirmation before running the command.

**-LiteralPath String requiredpipeline: True (ByPropertyName)aliases: FullName, PSPathsets: LiteralPath**

Literal source RTF file.

## 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).

<!-- PowerForge markdown artifact sha256:49457C4751394720CA380E55C5966A1540BA0F022A66432B08EA4FBF94D4C066 -->
