CopyToClipboard

CopyToClipboard[expr]

replaces the contents of the clipboard with expr.

Details

  • The expression expr is evaluated and typeset before being copied to the clipboard. To copy a textual form, specify a string or InputForm[expr].
  • CopyToClipboard[Defer[expr]] copies the unevaluated form of expr.
  • CopyToClipboard["string"] copies the contents of "string" as plain text.
  • The expression expr can be any expression, including those that represent notebooks or cells.
  • CopyToClipboard supports typeset expressions, such as StandardForm and TraditionalForm.
  • When pasted in between cells, the results of CopyToClipboard will be at the highest fidelity. Style or formatting information may be lost when pasting into an existing cell or when pasting into an application other than the Wolfram System.

Examples

open allclose all

Basic Examples  (4)

Copy a simple expression to the clipboard:

Use Defer to copy an unevaluated form of the expression:

Copy the StandardForm representation of an expression:

Copy the InputForm representation of an expression:

Scope  (3)

Copying a string copies the contents of the string:

a+b

Copy a graphic:

Copy an interface:

Generalizations & Extensions  (2)

A series of discrete cells can be copied by using DocumentNotebook:

onetwo

Copied cells preserve any specified style information:

Applications  (2)

Create a button to copy the contents of an interface:

Pick a point and copy its coordinates:

Properties & Relations  (1)

Copying a cell expression preserves that expression exactly on the clipboard:

Possible Issues  (2)

Evaluation of expressions can have unexpected effects such as reordering the copied result:

All such effects can be prevented using Defer:

When CopyToClipboard receives a string with embedded typesetting, it is copied using linear form:

Wolfram Research (2010), CopyToClipboard, Wolfram Language function, https://reference.wolfram.com/language/ref/CopyToClipboard.html.

Text

Wolfram Research (2010), CopyToClipboard, Wolfram Language function, https://reference.wolfram.com/language/ref/CopyToClipboard.html.

CMS

Wolfram Language. 2010. "CopyToClipboard." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CopyToClipboard.html.

APA

Wolfram Language. (2010). CopyToClipboard. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CopyToClipboard.html

BibTeX

@misc{reference.wolfram_2024_copytoclipboard, author="Wolfram Research", title="{CopyToClipboard}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/CopyToClipboard.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_copytoclipboard, organization={Wolfram Research}, title={CopyToClipboard}, year={2010}, url={https://reference.wolfram.com/language/ref/CopyToClipboard.html}, note=[Accessed: 22-November-2024 ]}