Suppose I have a long string and I copy it to the clipboard:
s = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345";
CopyToClipboard[s]
When I paste the clipboard contents into a text editor I get that string all on a single line.
But when I use
CopyToClipboard[{s}]
I get
{"12345678901234567890123456789012345678901234567890123456789012345678\
90123456789012345"}
How can I avoid the line splitting? I see Options
and Streams
and TotalWidth
in the documentation but I can't make heads or tails of any of it.
(You might wonder why I'm using {s}
rather than just s
: That seems to be the only way I can get a CDF document to copy anything to the clipboard.)
CopyToClipboard[ToString@{s}]
$\endgroup$CopyToClipboard[InputForm@{s}]
it depends of what do you want for quotes... $\endgroup$CopyToClipboard["{" <> s <> "}"]
$\endgroup$CopyToClipboard[ToString@{s}]
does the trick. AndCopyToClipboard["{" <> s <> "}"]
does not produce any output to the clipboard in a CDF document. It seems (to me) that in a CDF document only lists can be copied to the clipboard. That leaves the dangling curly brackets to deal with but that's a different question and not so critical for my needs. If you write-up your first comment as an answer I'll gladly accept it. $\endgroup$SetOptions[$FrontEndSession, {"PageWidth" -> 1000, "ExportTypesetOptions" -> {"PageWidth" -> 1000}}]
. I have no idea how this relates to CDF. $\endgroup$