Clipboard.SetRTFText
--------------------

Puts RTF data on the clipboard.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Clipboard](component_Clipboard.md) | [5.0](newinversion50.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "Clipboard.SetRTFText"; RTFText { ; Encoding } ) 

**MBS**( **"Clipboard.SetRTFText";** /\* Puts RTF data on the clipboard. \*/  
**$RTFText**; /\* The RTF data to put in clipboard.e.g.   
"{\\rtf1\\ansi\\ansicpg1252\\cocoartf1265\\cocoasubrtf210  
\\cocoascreenfonts1{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}  
{\\colortbl;\\red255\\green255\\blue255;}  
\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural  
  
\\f0\\b\\fs28 \\cf0 Hello World}" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is Windows ANSI.e.g. UTF8 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| RTFText | The RTF data to put in clipboard. | "{\\rtf1\\ansi\\ansicpg1252\\cocoartf1265\\cocoasubrtf210   \\cocoascreenfonts1{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}   {\\colortbl;\\red255\\green255\\blue255;}   \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural      \\f0\\b\\fs28 \\cf0 Hello World}" |  |
| Encoding | The text encoding for text parameter.    Default is Windows ANSI.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | UTF8 | Optional |

### Result

Returns OK or error.

### Description

Puts RTF data on the clipboard.  
See also [Text.TextToRTF](TextTextToRTF.md) to convert formatted text to RTF.  
  
For server this will modify the clipboard of the user account running the server app on the server computer and not the clipboard of any client.  
  
On Windows you may want to use [Text.ReplaceNewLine](TextReplaceNewLine.md) first to convert line endings. FileMaker on Windows uses Mac line endings internally.  
### Examples

Put text on clipboard:

 MBS ( "Clipboard.SetRTFText"; "{\\rtf1\\ansi\\ansicpg1252\\cocoartf1265\\cocoasubrtf210  
\\cocoascreenfonts1{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}  
{\\colortbl;\\red255\\green255\\blue255;}  
\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural  
  
\\f0\\b\\fs28 \\cf0 Hello World}"; "UTF8" )  
Put HTML on the clipboard via RTF:

 Set Variable \[ $r ; Value: MBS ( "[RichText.ReadHTML](RichTextReadHTML.md)"; Assets::Description ; "utf-8" ) \]   
Set Variable \[ $r ; Value: MBS ( "Clipboard.SetRTFText"; MBS ( "[RichText.RTF](RichTextRTF.md)" )) \]  
### See also

- [Clipboard.GetHTMLText](ClipboardGetHTMLText.md)
- [Clipboard.GetRTFText](ClipboardGetRTFText.md)
- [Clipboard.GetText](ClipboardGetText.md)
- [Clipboard.SetHTMLText](ClipboardSetHTMLText.md)
- [Clipboard.SetStyledText](ClipboardSetStyledText.md)
- [Clipboard.SetText](ClipboardSetText.md)
- [RichText.ReadHTML](RichTextReadHTML.md)
- [RichText.RTF](RichTextRTF.md)
- [Text.ReplaceNewLine](TextReplaceNewLine.md)
- [Text.TextToRTF](TextTextToRTF.md)

### Example Databases

- [Clipboard](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Clipboard.shtml#1Button25.0000000690.000000050.0000000803.0000000LayoutObjectAnchor_)

This function checks for a license.

Created 17th November 2014 , last changed 16th December 2022

  
[Clipboard.SetPicture](ClipboardSetPicture.md) - [Clipboard.SetStyledText](ClipboardSetStyledText.md)

[HTML Version](ClipboardSetRTFText.shtml)