DHTML Editor -- MS Word Tags problem

27 views
Skip to first unread message

BPD

unread,
Aug 15, 2002, 2:16:10 PM8/15/02
to
Hi,

We've built an HTML editor into our web-based application (it's the DHTML /
javascript thing that many people are using nowadays). Anyway, I've noticed
that when I copy text from a MS Word document and paste it into the editor
window, all the XML / CSS / Whatever tags that Word uses get copied over
too. The problem with this is:

1. Our editor has no way of creating, editing, or deleting any XML or CSS...
only <font> (we have a "Remove Formatting" function, but it only works for
<font> tags... it won't even touch CSS)
2. Therefore, we've had a LOT of trouble editing the formatting (bold,
italic, font, etc) of text that's been copied from Word. This is because the
Word tags are competing with the <font> tags... sometimes the Word tags take
control, sometimes the <font> tags win out.

This is obviously a HUGE problem for an alleged WYSIWYG system because WYS
is not always WYG. The makeshift solution we've come up with for the time
being is simply to NOT use Word (use a plain-text editor instead), which
really isn't a viable solution at all, since most of the known business
universe uses Word.

Has anyone run into this and come up with a solution? Many thanks :)

--
-------------------
Brian P Donohue
Thumbprint Interactive (TM)
www.thumbprintweb.com

Jonathan Snook

unread,
Aug 16, 2002, 6:51:24 AM8/16/02
to
There's a few different solutions out there. I have a javascript routine
which strips all the excess code out. Basically, I do it in two phases. The
first is to cycle through every element and strip the class and style
attributes and then I do search and replaces to remove empty paragraph tags,
xml code, etc.

--- code ---

/* clean up word content */
// remove all class and style attributes
for (var intLoop = 0; intLoop < workspace.all.length; intLoop++) {
el = workspace.all[intLoop];
el.removeAttribute("className","",0);
el.removeAttribute("style","",0);
}
// remove all xml prefixes and smarttags
var html = workspace.innerHTML;

html = html.replace(/<o:[pP]>&nbsp;<\/o:[pP]>/g, ""); // Remove all
instances of <o:p></o:p>
html = html.replace(/o:/g, ""); // delete all o: prefixes
html = html.replace(/<st1:.*?>/g, ""); // delete all smarttags
html = html.replace(/<[pP]><\/[pP]>/g, ""); // delete all empty
paragraph tags
html = html.replace(/<[pP]>&nbsp;<\/[pP]>/g, ""); // delete all empty
paragraph tags

--- code ---

"BPD" <don...@paonline.com> wrote in message
news:#vzTueIRCHA.1440@tkmsftngp11...

Alejandro Jimenez

unread,
Aug 19, 2002, 3:48:09 AM8/19/02
to

Try this.

http://office.microsoft.com/downloads/2000/Msohtmf2.aspx

Regards

Alejandro.
--
Ce message a ete poste via la plateforme Web club-Internet.fr
This message has been posted by the Web platform club-Internet.fr

http://forums.club-internet.fr/

steffest

unread,
Aug 20, 2002, 4:04:52 AM8/20/02
to
Hi there.
I assume you can't expect people to first paste their word content in
another application, before pasting it the wysiwyg editor, unless
someone knows the source code for this filter, or knows what it does
concretely, so one can integrate it in an mshtml editor.

Steffest

On 19 Aug 2002 07:48:09 GMT, Alejandro Jimenez <acho...@yahoo.es>
wrote:

Davef

unread,
Aug 20, 2002, 11:10:59 PM8/20/02
to
How do I use this once I install this? and will this work for Office xp

--
-----------------------------------
David Fetrow
HelixPoint LLC.
da...@helixpoint.com
717-732-4335
-----------------------------------
"Alejandro Jimenez" <acho...@yahoo.es> wrote in message
news:2002819-8...@foorum.com...

BPD

unread,
Aug 20, 2002, 11:27:56 PM8/20/02
to
Thx everyone :) We will try your suggestions!!!

We've been telling people to save their Word docs as Text only, then paste
from the .txt file to the HTML editor. This method DOES work, but it's a
real pain in the butt... not a very user-friendly work around.

We've also found another, related bug... this time in the HTML editor
itself. It will not let you make your text Arial!!! The text is Arial by
default, but I cannot assign the Arial font to selected text. In code view,
no font tags appear... although all other fonts work fine.

Anyone had this problem?

Thx again...

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

Corjan

unread,
Oct 5, 2002, 11:20:51 AM10/5/02
to
There is a nice workaround:

Step1:
In your editor: add a new function called "Import Word file..."

Step2:
- Code a function in which you create a FileOpen dialog en thus letting the
user to point to a Word file.
- Let TIDY process this inputstream en when finished let tidy output the
stripped code to the editor.

I'm sorry I haven't got an example, but I have programmed this before. It
works!

More info: http://www.w3.org/People/Raggett/tidy/
Download: http://tidy.sourceforge.net/

Good Luck, Corjan
"steffest" <stef...@hotmail.com> wrote in message
news:s5t3mu4i1q68m2j8k...@4ax.com...

Reply all
Reply to author
Forward
0 new messages