Cleaning up Word HTML

If you are like me, on occa­sions you have people want to paste dir­ectly from Word into CMS or Word­press. I was bemoan­ing the fact, that you either end up with Word HTML or lose all the format­ting, when a col­league of mine, Steven Miles sug­gest I use JavaS­cript to clean up the HTML and provide the some code.

So this is what I cre­ated to clean up Word HTML, you paste the HTML is to the edit­able div, hit the but­ton and if you are using Inter­net Explorer the con­ver­ted HTML is copied to your clip­board. So you can paste the clean HTML (note it is HTML code) straight into the CMS editor in HTML mode or WordPress.

Note, while you can use JavaS­cript to add to the clip­board with Inter­net Explorer, you need to use Flash to copy the con­tents to the clip­board for other browsers. I have not do that yet. Mainly because Inter­net Explorer is the cor­por­ate browser and this was cre­ated for work.

So have a look under the hood, see how it works, take the code and modify it for your own use. It appears to be work­ing for what I need, but maybe needed to be mod­i­fied for your situation.


*** does not cur­rently work in IE8, I need to invest­ig­ate further ***

2 Responses to “Cleaning up Word HTML”

  1. Kim Says:

    went to use your cleaner but keep com­ing up with errors on the page
    The fol­low­ing text appears at the top of the page and I can’t paste or type in the entry field.
    I am using IE 8. The page opends fine in Fire­fox but won’t pro­cess the text.

    … 5 Octo­ber 2009 Nick cut the javas­cript out the com­ment, that caused it to get stuck in the spam queue …

  2. Nick Says:

    Oops! serves me right for not check­ing in IE8 (unavail­able at work), I will attempt to fix that in the next couple of weeks. Cur­rently hid­ing out in Sydney with Mac­book and iPhone to con­nect to the web.

    Kim, you can use Fire­fox and Safari to pro­cess the text, paste it into the first box, hit the but­ton, hit return to ignore the alert about not using IE and then you just need to cut the pro­cessed text from the second box, it is not auto­mat­ic­ally placed in your clipboard.

Affiliates

Google
text advertising by
Powered by Reseller Zoom