# New-OfficeRtf

Creates an RTF document, optionally with paragraphs from -Text or the pipeline.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`System.String[]`

**Outputs**

`OfficeIMO.Rtf.RtfDocument`

**Source**

[NewOfficeRtfCommand.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Rtf/NewOfficeRtfCommand.cs#L15) 

Creates an RTF document, optionally with paragraphs from -Text or the pipeline.

## Syntax

```
New-OfficeRtf
[-Force]
[[-Path] <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-new-officertf-switchparameter-string-switchparameter-switchparameter)

Parameter set: `Live`

```
New-OfficeRtf
[-Force]
[-PassThru]
[-Path] <String>
[-Show]
[-Text] <String[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-new-officertf-switchparameter-switchparameter-string-switchparameter-string-switchparameter-switchparameter)

Parameter set: `Text`

```
New-OfficeRtf
[-Content] <ScriptBlock>
[-Force]
[-PassThru]
[-Path] <String>
[-Show]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
```

[#](#method-new-officertf-scriptblock-switchparameter-switchparameter-string-switchparameter-switchparameter-switchparameter)

Parameter set: `Content`

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

### Use the native OfficeRtf command.

```powershell
New-OfficeRtf -Path .\Note.rtf -Text 'Server maintenance starts at 22:00.'
```

## Parameters

**-Force SwitchParameter optional**

Force for this operation.

**-Path String required in Text, Contentposition: 0**

Path for this operation.

**-WhatIf SwitchParameter optional**

Shows what would happen if the command runs.

**-Confirm SwitchParameter optional**

Prompts for confirmation before running the command.

**-PassThru SwitchParameter optionalsets: Text, Content**

PassThru for this operation.

**-Show SwitchParameter optionalsets: Text, Content**

Show for this operation.

**-Text String[] requiredposition: 1pipeline: True (ByValue)sets: Text**

Text for this operation.

**-Content ScriptBlock requiredposition: 1sets: Content**

Content for this operation.

## 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:1158E6FFAEF6B76AE21A2ED4A588A3682BDE590155F8BA0BD6F0ED7FEA4267AA -->
