| clipboard {utils} | R Documentation |
Read/Write to/from the Windows Clipboard
Description
Transfer text between a character vector and the Windows clipboard.
Usage
getClipboardFormats()
readClipboard(format = 1, raw = FALSE)
writeClipboard(str, format = 1)
Arguments
format |
an integer giving the desired format. |
raw |
should the value be returned as a raw vector rather than a character vector? |
str |
a character vector or a raw vector. |
Details
The Windows clipboard offers data in a number of formats. The standard formats are
| CF\_TEXT | 1 |
| CF\_BITMAP | 2 |
| CF\_METAFILEPICT | 3 |
| CF\_SYLK | 4 |
| CF\_DIF | 5 |
| CF\_TIFF | 6 |
| CF\_OEMTEXT | 7 |
| CF\_DIB | 8 |
| CF\_PALETTE | 9 |
| CF\_PENDATA | 10 |
| CF\_RIFF | 11 |
| CF\_WAVE | 12 |
| CF\_UNICODETEXT | 13 |
| CF\_ENHMETAFILE | 14 |
| CF\_HDROP | 15 |
| CF\_LOCALE | 16 |
| CF\_MAX | 17 |
| CF\_OWNERDISPLAY | 128 |
| CF\_DSPTEXT | 129 |
| CF\_DSPBITMAP | 130 |
| CF\_DSPMETAFILEPICT | 131 |
| CF\_DSPENHMETAFILE | 142 |
| CF\_PRIVATEFIRST | 512 |
| CF\_PRIVATELAST | 767 |
| CF\_GDIOBJFIRST | 768 |
| CF\_GDIOBJLAST | 1023 |
Applications normally make data available in one or more of these and possibly additional private
formats. Use raw=TRUE to read binary formats, raw=FALSE (the default)
for text formats.
The writeClipboard function will write a character vector as text, with standard
CR-LF line terminators. It will copy a raw vector directly to the clipboard without any changes.
Value
For getClipboardFormats, an integer vector of available formats.
For readClipboard, a character vector by default, a raw vector if raw is
TRUE, or NULL, if the format is unavailable.
For writeClipboard an invisible logical indicating success or failure.
See Also
file which can be used to set up a connection to a clipboard.