This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Hierdie gesprek is in die argief. Vra asseblief 'n nuwe vraag as jy hulp nodig het.

When I copy a text from MS Word and paste it into my HTML page in Firefox, it brings over too many style definitions. Can that be avoided?

  • 7 antwoorde
  • 10 hierdie probleem
  • 2 views
  • Laaste antwoord deur msameer

more options

Basically I have an HTML with DIV tag and having contentEditable set to true. Whenever I copy content from MS Word and paste it in this html, it brings over tons of styles and messes up the whole content. Same set of actions work fine on same HTML in IE !

Basically I have an HTML with DIV tag and having contentEditable set to true. Whenever I copy content from MS Word and paste it in this html, it brings over tons of styles and messes up the whole content. Same set of actions work fine on same HTML in IE !

Gekose oplossing

There is an online tool at


      http://demo.typps.com/Editor/mswordcleanup.aspx
      and 
      http://www.textism.com/wordcleaner/ 
       (for 20kb docs or less)

that will strip Word's proprietary tags from an HTML document.

You might find the following article to be informative:


      http://gabesumner.com/copy-from-ms-word-paste-into-a-rich-text-wysiwyg-editor

You can always use the SeaMonkey Composer editor instead of Word. See:


      http://www.seamonkey-project.org/

SeaMonkey is a Mozilla project built from Firefox.


edited to add textism

Lees dié antwoord in konteks 👍 1

All Replies (7)

more options

One solution -- don't do that.

Microsoft wrote both IE and MS Word, IE will be looking at the same code generated.

So what do you mean that you get too many styles, is that an error message, or you just don't like the generated code, or that the generated code does not work.

more options

I don't get any errors and generated code works. But the generated code overcomplicates the basic styles. E.g. I used bold feature on a word called "Hello" and and I get 50 styles added in the div field after copy-paste. Whereas in case of IE I get a clean tag around the same word "Hello". So this operation is more clean and intelligent in case of IE but in case of Firefox it just puts so much data that my field widths are on the brink of overflow!

more options

Would you supply the application, content, url descriptions as well as you can for each, and exactly what you are doing.

1) source where "Hello" is being brought from
2) target where you are pasting into with Firefox
3) and with IE
4) where you see the source directly in what you paste or by viewing source

Is this a WYSIWYG editor where what you normally see is what it is going to look like when finished.

A simple change or difference in fonts font-size could make a big difference in what is happening.

Gewysig op deur David McRitchie

more options

Sure. I can. How do I attach it here? There is one sample HTML file and then i can send a sample Word document with a bold "Hello" text just to illustrate the issue.

more options

Extra code is one of the pitfalls of using WYSIWYG cutting and pasting, and using styling in general.

So while it may be interesting to try to reduce the amount of code, there probably won't be any direct approach without extra steps to get you what you want with bare bones code that appears as you want it to or at least acceptable.

I guess you might have to take a screen image, clip the relevant portion, since you can only attach an image file here not a text file.

Posting a screen shot

more options

Gekose oplossing

There is an online tool at


      http://demo.typps.com/Editor/mswordcleanup.aspx
      and 
      http://www.textism.com/wordcleaner/ 
       (for 20kb docs or less)

that will strip Word's proprietary tags from an HTML document.

You might find the following article to be informative:


      http://gabesumner.com/copy-from-ms-word-paste-into-a-rich-text-wysiwyg-editor

You can always use the SeaMonkey Composer editor instead of Word. See:


      http://www.seamonkey-project.org/

SeaMonkey is a Mozilla project built from Firefox.


edited to add textism

Gewysig op deur sctl

more options

Thanks folks for your help. Reply from #sctl was helpful in finding a tool for cleaning up the "garbage" ms word introduces.