Friday, June 24, 2011

DevTnT v2.1 – Windows: Remove Formatting via the Shell’s Run Dialog

Sometimes you want to copy text from a formatted source and paste just the text without the formatting. For example when you write an e-mail to a colleague citing some source code you might not want to disturb your mail’s formatting by pasting the source code with its original formatting.

To illustrate the problem, here is the effect of pasting from Visual Studio into a mail window in OWA (Outlook Web Access):

Effect of pasting formatted text into a mail window in OWA (Outlook Web Access)

If you are pasting into a Microsoft Office application, there is the feature to paste as text only using the smarttag shown after pasting:

SmartTag Paste Options in Microsoft Office

But if your paste target does not provide such feature you’re out of luck.


The solution for this problem is to perform an intermediate unformatting step between copy and paste. For that you just need to paste your formatted text into some application that does not support formatting. Typically, any text editor can be used for that.

But since launching another application may be too disturbing just for the merit of copy and paste, there is an application always at your fingertips: the Run dialog of your Windows shell.

Thus, to remove the formatting of a single line of text, you just press Win+R, paste using Ctrl+V, select the whole text using Ctrl+A and copy it again with Ctrl+C (and close it afterwards with ESC):

Text pasted to the Windows Run dialog

Remark: In Windows XP the Ctrl+A shortcut does not work. As a workaround, you have to move the caret back to the beginning of the text while holding down the shift key.

Then the clipboard contains just the characters but no formatting, and that’s what keeps your target formatting sane:

Pasting unformatted text into a mail window in OWA (Outlook Web Access)

Great and easy.

No comments:

Post a Comment