Tell me more ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

So normally I wouldn't use this feature ("Save as Web Page") but I have large documents from clients they just want put on their site as HTML, and formatting it all by hand seems like a waste of time.

I have tried "save as webpage" in Word 2007, but it produces all sorts of bad stuff. To wit:

<b style='mso-bidi-font-weight:normal'>
<span style="mso-spacerun: yes">

as well as a large block of XML formatting info:

<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
 <o:Subject> </o:Subject>
 <o:Author> </o:Author>
 <o:Keywords> </o:Keywords>
 ...

As I said, formatting it all by hand seems like a waste of time, but the way MS exports currently just has too much cruft. Is there a way to export MS Word doc as html without all this?

EDIT: This document is a charter/bylaws type document and therefor has many levels of nested list. One of my criteria for "success" in this conversion endeavor is that the list hierarchy is retained, not discarded.

share|improve this question

4 Answers

There are some good answers in this What is the best free way to clean up Word HTML?

with HTMLTidy coming out on tops

share|improve this answer
I don't think this will work in this case because the HTML is too far gone. The list hierarchy has been basically totally discarded in favor of some strange <![if !supportLists]> stuff with nonbreaking spaces for indentation. I don't think tidy can bring it back from this point. Good tip tho, generally speaking! Thank you! – sequoia mcdowell Mar 10 '11 at 19:04

You can always use another application as an intermediary, like LibreOffice, and use it to save it as an HTML document.

LibreOffice (formerly OpenOffice, which is still available if you prefer it) generates much cleaner code comparatively.

share|improve this answer
Thank you for the suggestion! Overall the markup was better but it didn't hit my success criteria. Issues: a) didn't preserve nested lists b) tried (failed) to base64 encode an image, definitely unexpected behavior (word just makes a dir with them). c) added odd/inappropriate unicode chars, to wit:  . not sure why it did this but it's not good. Styles were much shorter than MSWord, and it looked alright overall, so there are some pros, but still a few deal breaking issues. – sequoia mcdowell Mar 10 '11 at 19:33

I has been a while since I've done this, but I believe that Google Doc's export to HTML works better than MS Word and I believe that Google Docs will read Word docs, so you might be able to load the doc into Google Docs and export it that way.

share|improve this answer
Tried it but the lists became broken on "Download as HTML" i.e. it did not preserve the hierarchy and made a bunch of extra lists. This is odd, because it had the lists nested properly within google docs, it only broke on export. – sequoia mcdowell Mar 10 '11 at 19:00

Try saving the Word document to an RTF format, then exporting that to HTML. Hopefully the RTF document wouldn't contain all of that complexity required in the Word document and will lead to simpler HTML.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.