Why pasting content from Word into Joomla is a bad idea

As it happens, readers email me about problems on their Joomla sites or about things they don't quite get. And I try my best to answer their questions. I don't have the time for doing specific support for every user that emails me, but sometimes a quick look at the site can help the user solve his problem easily.

Last week, a reader emailed me about some problems with the content on his site. For some reason, the content was showing nicely on all browsers except on Internet Explorer 8. Was I able to help?

The reader told me the following:

I have recently edited all the website's article using JCE Editor. When testing in various browsers, FF, Crome, Safari, all work fine. But IE8 a lot of the articles are missing. After days of searching the web for a solution, it’s clear many people have problems with IE8 and Joomla.

He then went on to explain some possible solutions he'd found on the web. Not so sure about these, my first thought was that it had something to do with the template he was using. After all, the Joomla platform or CMS doesn't have problems with any browser at all. The template contains the code that is output to the user's browser. Thus, the best place to look at first is the source code provided by the template (and at the content entered by the user into Joomla).

I looked at the code in Internet Explorer 8, and sure enough, the content didn't show. It showed up fine in Firefox on the same computer, though. Then I took a look at the source code in IE 8. And there it was… It turned out, the reader had edited his text in Microsoft Word and pasted the content directly from there and into the Joomla editor (JCE). This is a recipe for disaster.

This is what I wrote back to him:

The problem is not with Joomla itself, but with the content you have entered into the page. For instance, if you look at the source code on one of your pages, you will see that the page contains a LOT of code which has been transferred over from MS Word.
At the start of this pasted code, you will notice the following: [if gte mso 9]...

This code snippet means the content will only show in Internet Explorer version 9 or greater (and in other browsers, since IE is the only one looking at these IF statements).

>

 

 

Be careful not to paste directly from Word into JCE, or at least use the "Paste from Word" function when doing so. That will remove all of the MS Word specific code from your page.

 

 

The reader replied:

Thank you for pointing out it's not good to copy from Word, I have never seen that advice anywhere before, and have done ALL my editing this way. I'll use Notepad from now on (or try the paste as plain text button next time).

 

 

So now i have pasted a lot of text from MS Word, do you know how i can fix this problem? How do i delete all the code which Word transferred over?

And then do I have to repaste everything again from Notepad?

This was my reply:

Copy the text out of the article (make sure you get everything out (check the source code panel in JCE), paste it into Notepad and repaste into the article.

Of course, when using JCE, he could also be using the "Paste from Word" icon, which strips Word specific coding from the content.

Don't paste directly from Word

So, pasting from Word should be done with caution. Word adds a lot of specific markup to the content that will be carried over to JCE or other WYSIWYG editors.

The markup is there to make sure the document looks the same when pasted. However, in most cases it is is totally useless and creates all sorts of problems. The above mentioned problem is just one.

Another common problem is that articles pasted from Word look different from other content on the site, as it contains style info that conflicts with the stylesheet of the Joomla template.

This has been a problem for years, and it will probably excist as long as Word is out there…

Setting up JCE to improve pasting from Word

If you have users on your site that often forget to paste using the "Paste from Word" function you can force JCE to strip Word styles.

Go to Components -> JCE -> Editor Profiles -> [Your profile]

Then navigate to Plugin Parameters and select the tab "Paste":

jce-paste-plugin

On this tab, you have some options that you can activate to have JCE remove more markup from the pasted content.

jce-paste-plugin-options

Read 24539 times Originally published on Tuesday, 06 December 2011 12:00
Last modified on Wednesday, 13 May 2015 23:18
 
comments powered by Disqus