Take the 2-minute tour ×
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
add comment

5 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
add comment

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
add comment

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
add comment

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
add comment

I know this is three years old, but I came across it looking for the same answer today, for Office 2010 anyway there is an option to save as "filtered HTML" without the extra Microsoft code :

About using filtered HTML

When you save Web pages or send e-mail messages in HTML format with Microsoft Word, additional tags are added so that you can continue to use the full functionality of Word to edit your content.

To reduce the size of Web pages and e-mail messages in HTML format, you can save them in filtered HTML so that the tags used by Microsoft Office programs are removed.

This feature is only recommended for experienced Web authors, who are concerned with the tags that appear in their HTML files.

If you reopen a Web page in Word that you saved in filtered HTML, your text and general appearance are preserved, but you may not be able to use certain Word features in the usual way to edit your files. For example, the appearance of bulleted or numbered lists is preserved; however, some of the Word functionality associated with lists will not be preserved.

When possible, you should only save a Web page in filtered HTML when you are finished editing the page in Word. However, if the underlying HTML of your Web pages is not important to you, you should save your files as a standard Web page.

If you will need to edit the file later, you can maintain two files: one in Word format and one in filtered HTML format. You can edit the content in the Word document, save it in Word format for future editing, and then save a copy in filtered HTML format.

share|improve this answer
add comment

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.