Sanitizing Text When Working on Websites
Copying and pasting from Microsoft Word is a well known problem using any CMS (WordPress, Joomla, etc.). This issue seems to come up a lot so we’ll explain it here and give you ways to make sure it does not happen.
Sanitize Formatted Text Before Pasting
When you copy anything (text, tables, images, etc.) from another program, like Microsoft Word for example, and then paste into an editor in your browser, some extra formatting information that Word has embedded comes along. This extra formatting information can often make some strange things happen in the editor because they are different programs and Word’s formatting is not pure (or good) HTML.
Copying and pasting from Word works best when you sanitize the text, removing that extra formatting. Here are two ways to do that:
- Copy from Word, open up a plain text document (Notepad program on Windows or TextEdit or TextWrangler for Mac) and paste into that program. Select all the text again, copy it again (make sure you do select all of it and re-copy it again) and then go into the editor in your web browser and paste. You will have to reformat things like bold and italic, but your text will be clean.
- Copy from Word, paste into the editor and then select what you just pasted in and find the “Remove Formatting” button (if it exists) – or sometimes there is a “Paste from Word” which you can use to paste text in. Your text should be clean from extra formatting now.
The first method is probably the best way to do it. WordPress has a good system for pasting from Word and so does Joomla.
If you need to copy and paste tables, then please note that you will have to rebuild the entire table again in HTML. Sorry.