Which applications accept pasting styled text…

I am using the standard idiom for styling the selected text, as shown (for example — there are others) in Inserting Styled Clipboard:

  • Type the ⌘C Keystroke
  • Apply Style to System Clipboard
  • Type the ⌘V Keystroke
  • Delete Past Clipboard 0

I have a number of macros that apply styles. I have been happily using them in TextEdit, but I have discovered that many (most?) applications don’t seem to accept pasted styled clipboards. A brief selection:

Works:

  • TextEdit
  • Stickies
  • Mail

Doesn’t Work:

  • Reminders
  • Notes
  • Evernote
  • Pages
  • Numbers
  • Word 2011

What have other people’s experiences been with this? Does it come down to which applications are using standard Cocoa text editors?

I'm not sure what you are doing, but it works for me in:

  • Notes
  • Evernote
  • Word 2011

and I suspect it would work in Pages, but I don't have that to test.

does not work in Notes, but looks just like yours.

Apple is not all that consistent about the formatting of styled text.

Firstly, deleting the clipboard after a paste will lead to inconsistencies - there is a reason Keyboard Maestro does not do this by default. If the delete happens before the application has processed the Command-V, then the application will see the previous clipboard, and then nothing will happen.

Reminders does not appear to support any styled text (maybe I’m missing something).

Notes - who knows, it just behaves weirdly for me. Indeed, if you copy styled text from TextEdit it does not work either.

Word 2016 has no problem that I could see.

Pages & Numbers don’t seem to pay attention to the change within a single paragraph. However if you select a whole line in Pages or a Cell in Numbers, then the change is applied (except that Numbers also adds an extra cell above and below, but, well, Apple…). Again, text copied from TextEdit behaves the same.

I don’t have Evernote, nor Word 2011.

I forgot to post my macro. Here it is. (I changed it to blue :slight_smile:.)

Blue Text.kmmacros (2.5 KB)

That is all very good to know.

I usually use Set Clipboard to Past Clipboard 1 (in this case I actually need 2). Is that better than Delete or does it have the same problems? The goal would be to restore the clipboard to the state it was in before applying the styled text, with neither the unstyled text or the styled text on the Clipboard History.

At the end of my macros where I want to restore the clipboard like it was prior to the start of the macro, I usually do this:

  • Pause 0.2
    • might need to increase if you pasted a really large clipboard
  • Delete Past Clipboard 0

I haven't seen any issues so far.

Could you please try my macro and see if it works in the applications yours does? I am still bewildered.

More complete and more accurate data. (There may be parts/contexts of some of these applications where pasting styled text works that I didn’t find.)

Application	Foreground?	Background?	Font?

TextEdit	√		√		√
Notes		X		X		X
Reminders	no formatting
il		√		√		√
Stickies	√		√		√
Evernote	X		X		X
Pages 		X		X		X
Numbers		X		X		X
Keynote		X		X		X
Word		√		X		√
Excel		X		X		X
Outlook Mail	√		√		√
PowerPoint	X		X		X
OmniFocus	X		X		X	[only in Notes]
OmniGraffle	√		√		√
OmniOutliner	√		√		√

If you want a rich-text solution (styled text) that works with most apps that accept rich text, then you may be better of creating the HTML with the text and style you want, and then convert to Rich Text on the clipboard.

You’re welcome to this handler/function, which someone else wrote the core parts of:

on copyHTMLasRTFtoClipboard(pstrHTML)
	
	set cmdStr to "echo " & quoted form of pstrHTML & " | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf"
	do shell script cmdStr
	
end copyHTMLasRTFtoClipboard

I’ve used it with great success.

1 Like

Please post a macro showing how this would be used, in particular to have the effect of your Apply Style to Clipboard macro above. Thanks.

@MitchellModel, here’s the pseudo code of the macro:

COPY text to clipboard
SET variable myText to clipboard
SET variable myHTML to HTML code using myText
Execute Shell Script to convert HTML to RTF, and put Clipboard

I’ll leave the implementation up to you.

With Notes.app, you can use Paste and Retain Style in the Edit menu to circumvent this.

2 Likes