When Plain Text Isn’t

One of the problems many beginner SharePoint content editors have is pasting text into SharePoint from other sources. The problem has to do with the unseen or hidden information embedded in the text that formats the text in these other products.

Take for example a typical passage of text in Microsoft Word as shown below:

If I were to simply copy this text from Microsoft Word into SharePoint, the result might at first look like a fairly good approximation of the original text as displayed in Word as shown in the following image.

However, when I look at the HTML of this text, I see that it is littered with embedded commands that would make it very difficult to edit by just looking at the visible portion of the text. The problem is that when I select text that is visible to me, I may not include all of the tags that wrapped around that text. Furthermore, if I were to try to change the style of the selected text, it may not appear to change if my selection included the original formatting tags that I want to replace, but are left in the code. The selection of the text may not even grab the embedded start and end tags, but only one or the other resulting in tags that are not property nested. The browser then struggles to interpret exactly what I want to do and may add additional but superfluous <div> tags to try to isolate the problem. While I could directly edit the HTML to fix these issues, I would not recommend this to the typical content editor unless I was very sure that they were familiar with HTML. In any case, the challenges of editing formatted text directly may be more than I typically want to handle.

One solution that I have been told to use in the past is to copy the text first to NotePad. NotePad does not support most of the special formatting features of Microsoft Word and therefore it strips out these embedded tags from the text. The following image shows the same text copied first to NotePad and then copied to SharePoint.

The text looks fairly clean of any special formatting. I might think that I can now easily go into this text and begin changing the formatting of specific portions of the text to match what I had in Microsoft Word. For the most part, I would be safe doing this. In fact, I am much better off than if I pasted the Microsoft Word text directly onto the SharePoint page. However, looking at the HTML of even this page, I can see that some special formatting still exists although it is not nearly as bad as the HTML pasted directly from the original Microsoft Word text.

Another option has been to try to remove the formatting from the text after pasting it on the page. To do this, I would first select all of the text that I just pasted and then open the Format Text ribbon as shown in the image to the right and select the icon that looks like the letter ‘A’ with an eraser to its lower right. The text that appears when I hover over this button says that it will clear all formatting from the selection leaving only plain text. While that sounds promising, in actual use, the results are less than I hoped for as the image below shows. Notice that the HTML, while starting to look fairly clean with only the actual text, still has a lot of formatting tags, specifically <div> and <span> tags.

Fortunately, in SharePoint 2010 there is another option, one that very few people find. Recognizing the problem with Copy and Paste, a method used by many people, Microsoft added a second paste option. When you are ready to paste your text in SharePoint, rather than just pressing the CTRL-V to paste the text that you have on the clipboard to the current cursor position, you can click on the lower half of the Paste button in the Format Text ribbon which happens to be the leftmost button on this ribbon. Clicking on the lower half of the button displays a submenu that includes the two options shown in the image to the right. The one that I am interested in is the option: Paste plaintext.

This time when I look at the resulting HTML, I see a much cleaner version of the text. The only special formatting left is the <BR> tags used to end paragraphs and create line breaks. The resulting text should be easy to maintain in SharePoint with the formatting tools in the Format Text ribbon.

In addition to the methods described here, there are many other text editing tools that allow you to either cut and paste text from your favorite editor or may even serve as an alternative text editor. I cannot attempt to evaluate them all here. Rather I will mention a few that I’ve heard of but leave it up to you to test whether they serve your needs. Two that come to mind are PureText for the PC which is a free download and Flycut for the Mac.

If you insist on using a browser other than IE (remembering that SharePoint was designed around integration with Microsoft products, not products from other companies), you might try one or more of the browser extensions for FireFox or Chrome that support copy and paste of just text. Just be aware that while some of these may work fine to copy text from one web page to another, they may not work fine with other applications such as Microsoft Word.

Finally, FireFox and Chrome allows you to paste just text by using the key combination CTRL+SHIFT+V. Similarly, the Macintosh uses the keys: Shift + OPTION + COMMAND + V.

If all of this seems like too much of a bother, remember that you can always create your text directly in SharePoint rather than starting from another text tool and then having to copy and paste that text into SharePoint. The SharePoint interface for entering text is very similar to Microsoft Word, or perhaps you use WordPad, and provides a good WYSIWYG interface for entering and formatting your text. Entering and formatting text directly within SharePoint practically guarantees that you will not have future issues editing the text.

That’s it for this week. C’ya next time.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s