Tuesday, March 31, 2009

Pasting Text From Word


Word to CMS

One issue with content management systems is that desktop computer users in organizations tend to have their information stored in the proprietary microsoft word format. Word is notorious for producing obtuse and convoluted HTML that does not play well with others.

The problem with a cms occurs when the desktop user opens Word and copies the text into the cms editor and publishes to the web site. Later they are shocked to see that the formatting has changed.

We decide to do a test of the default TinyMCE joomla editor and the JCE editor extension using a simple word document and one with a heavily formatted complex table with colors and other stuff. Tables are one of the hardest things to convert.

Installing JCE

First we have to install JCE. Off to http://www.joomlacontenteditor.net/downloads where we need 3 parts - the editor extension and 2 plugins for the editor. Here are the task for this bit:
  1. Click Administrative Component
  2. Select com_jce_152.zip
  3. Click back arrow
  4. Click Editor Plugin
  5. Select plg_jce_152.zip
  6. Click back button
  7. Select JCE Utilities
  8. Click Joomla 1.5.x
  9. Select plg_jceutilkities_217.zip
Now that we have the files all downloaded it's time to install. Before doing this you have to edit the php.ini file in the \xampp\apache\bin folder to increase the timeout setting. I changed mine to:

max_execution_time = 480

and saved the file. Now you can run XAMPP and start up Joomla. The reason for the change is that the JCE scripts timeout when running on a USB stick. I timed the plugin install at almost 8 minutes! Next we need to install the extension and plug-ins for JCE.

Installing JCE
  1. Select Extensions, Install/Uninstall
  2. Browse to com_jce_152.zip
  3. Click Upload File and Install
  4. Select Extensions, Install/Uninstall
  5. Browse to plg_jceutilkities_217.zip
  6. Click Upload File and Install
The install works but displays an error message:

Unable to add Article Breaks plugin to Plugins table

This is because the Article Breaks plugin is already installed from our previous JCE install attempt. You can confirm this by looking at thedatabase, there is a row for the Article Breaks plugin in the jos_jce_plugins mySQL table. However, this does not stop the editor from working so you can ignore the error.

We then tried to install the editor plug-in plg_jce_152.zip and it returned the following error:

JInstaller::install: There is already a folder called 'F:\xampp\htdocs\joomla\plugins\editors\jce.php'. Please initially check whether:

This was because the previous installation attempt had whitescreened (timed-out) and so the file jce.php already existed.

The solution was to delete jce.php from the xampp\htdocs\joomla\plugins\editors folder and run the install again. This time it worked.

Configure the Joomla Editor

Select Site, Global Configuration Manager
Select Editor - JCE 1.5.2 from the Default WYSIWYG dropdown menu
Click SAVE

Now you have access to the JCE editor which has lots of little icons. Designers should read William Horton's Icon Book. too many applications have icons with no readily discernable meaning. Anyway now it is time for the word paste test.

Pasting From Word

The test consists of opening files in Word, copying the formatted text with CTRL C and pasting it to the joomla editor with CTRL V, Saving the article and previewing it in the user view. No editing or changes are permitted in the cms editor.

We open the simple word file and copy and paste to the default and JCE editors with no problem. All formatting is preserved so let's move on to the complex word document.

We paste into the default editor. It preserves the table, the colors, borders etc but changes the format of the header.

We try JCE using the Paste From Word function which opens a small window into which you can paste your copied word text.

The result is disappointing - the header is ok with some small changes, but the table has lost all the color! Does this mean JCE is worse that the default TinyMCE editor?

We decide to just paste in the word text without using the 'Paste From Word' function. To our amazement it works perfectly - all the table is there, complete with colors and the heading formatting is exactly the same as the word document - no need to mess about.

Conclusion

Obviously, more testing is required before coming to any conclusion but the test does indicate that word to joomla may not be a problem. If I was doing this i would create a test suite of documents submitted by users based on their most commonly used files and their most complex files and run them through the JCE editor and show the results to the users.

------------------------------------------------------------------------

Note that if you already have JCE installed you will get an error message:

* Component Install: Another Component is already using directory: "G:\xampp\htdocs\joomla\components\com_jce" * Component Install: Another Component is already using directory: "G:\xampp\htdocs\joomla\administrator\components\com_jce"

The solution is to remove the old extension before installing the new.

To Remove an Extension
  1. Select Extensions, Install/Uninstall
  2. Click Components, Modules, Plugins, Languages, or Templates to find your extension
  3. Select the extension
  4. Click the Uninstall button.

1 comment:

NMBSailorGirl said...

Great post, thanks for taking the time to do this - it saved me the work!