I have a highly formatted document which I would like to render in htmlarea as close as possible to the way it is rendered in Microsoft Word. I found that a simple cut and paste of the formatted text doesn't achieve my goal, so I figured I would go into htmlarea's "text mode" and insert straight HTML. I used Word's "Save As.. web page" to generate the HTML.

Unfortunately, pasting all of the HTML that Word generates, results in the Drupal error message, "terminated request because of suspicious input data" It doesn't matter whether I ask Word to save it as "web page" or "single file web page." Interestingly enough, htmlarea DOES render it properly!

I am running on Drupal 4.5 and I have no way of knowing which of the excess HTML that Word generates may be causing this problem. Previous posts related to this error didn't mention Word specifically.

Comments

dries’s picture

You can enable the 'by-pass input checking'-permission.

The reason it works with HTMLArea is because HTMLArea tidies up MS Word's mess.

killes@www.drop.org’s picture

Microsoft products are well known to produce bad and bloated html. I suggest to run the generated html through an application such as htmltidy before pasting it into Drupal.

--
If you have troubles with a particular contrib project, please consider filing a support request. Thanks. And, by the way, Drupal 4.5 does not work with PHP 5.

Steve Dondley’s picture

There are also products out there that will convert Word's version of HTML to a more standard's compliant version. I know Dreamweaver MX has that capability. I'm sure there are programs out there you could download to do the same thing.

NaSPA1’s picture

Actually, I have a similiar requirement to allow my users to "copy & paste" from word to Drupal while hopefully maintainig as much formatting as possible. While I have Dreamweaver (and a multitude of other tools) they are beyond the scope of my users, so I need something close to cut & paste from word.

Will the work around here allow us to do this?

Radi

Steve Dondley’s picture

I have not used the feature myself so I can't tell you what exactly it does, but the HTML Area module has an icon to perform operations on Word formated HTML. Check it out. It may be just what you need: http://drupal.org/project/htmlarea

Steve Dondley’s picture

I see now that you have explored HTMLArea already. But did you try the function to import Word HTML using HTML Area?

jprusky’s picture

The feature's icon looks like a Word document. The good news is that it gets the user past the error message. The bad news is that it clobbers too much of the HTML.

I use "styles" (indirect formatting) extensively in my Word document, which Word's HTML does provide for. However, the "Clear MS Office tags" feature deletes something which prevents those styles from rendering properly. :-(

Steve Dondley’s picture

How badly do you need this functionality? How about hacking it yourself or paying someone so it performs the way you need it to?

andre75’s picture

I have a similar problem. While I can not use FCKeditor (since it won't work with Image Assist), TinyMCE automatically cleans up Word html, but ONLY if you use it with IE (sigh).
Well I figured that users who use Word may also use IE. I wrote a message saying this is what you should do if you paste Word code.
Tiny cleans it up nicely if you paste it while using IE.

Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

y2kbugs159’s picture

don't use ms word lor...

i'll prefer using dreamweaver than any others.
or else, try mastering ur html skill and use notepad only.

using notepad suggestion
------------------------
create a empty htmlref.txt notepad
then paste ur recent html sample code here.
this htmlref.txt is just like a library.

Tommy Sundstrom’s picture

Maybe this filter that removes some of the non-standard tags can help.

glennp’s picture

I have Word 2002 SP3, and, after looking at the link Tommy suggested (to a filter for Word 2000), notice that among the "save as" choices is "web page, filtered". The Word online help also discusses it briefly (more briefly than Tommy's link).

I'm hoping this works out for my lengthy Word docs. I'll know in a few weeks.

danepowell’s picture

Sorry to revive a very old thread, but for anyone searching for a solution to Office-generated HTML gunk and landing on this page, try the Office HTML Filter