Ctrl+C and Ctrl-X are one of the most used key combinations on my keyboard (only just out ranked by Ctrl-Z)! But there's more to Crtl-C / Ctrl-X than meets the eye!

The clipboard supports multiple formats of the data stored in it. So what does that mean? These quotes from Clipboard Formats best explain this:

"A window can place more than one clipboard object on the clipboard, each representing the same information in a different clipboard format."

"For example, suppose a user copies styled text from a word-processing document. The window containing the document might first place data on the clipboard in a registered format, such as RTF. Subsequently, the window would place data on the clipboard in a less descriptive format, such as text (CF_TEXT). When the content of the clipboard is pasted into another window, the window retrieves data in the most descriptive format it recognizes. If the window recognizes RTF, the corresponding data is pasted into the document."

Herein lies the problem; you think you're pasting just the text, but you're actually pasting in additional formatting. The additional formatting often overrides the styles used on the wiki. This can lead to inconsistent formatting of text (fonts, font-sizes, font-colors), strange indenting (tabs), and hard to read html (if you ever need to use the HTML view of the Wiki editor)!

The best approach for copying content from other sources is:

1. Copy the text from the source
2. Paste the text into a text editor (like notepad or notepad++). This will strip out all the formatting (as notepad/text editors generally only support pasting text, without advanced formatting)
3. Format the text in the text editor (add/remove tabs, fix line spacing, add/remove carriage returns, etc)
4. Copy the text from the text editor into the Wiki text editor

Just for fun, here is a comparison of HTML created from copying code out of Word. The first example demonstrates the HTML generated when the text is copied directly from Word to the Wiki editor. The second example uses the technique described above.

*Note: While creating this example, I noticed that the Wiki editor now prompts you to clean up the formatting of the content being pasted from Word. When I tested this in different browsers, I got different HTML results from both browsers (IE10 and Chrome). 

Original text from a Word 2013 document:

HTML Produced from Word text copied directly into the Wiki Editor

HTML produced by copying the text to a text editor first, then formatting the text in the Wiki editor

HTML produced by copying the text from Word into the Wiki editor, and selecting to clean up the formatting (Internet Explorer)

HTML produced by copying the text from Word into the Wiki editor, and selecting to clean up the formatting (Chrome)

See Also

Other Posts in this series: