10

I'm in need for saving a Word document as HTML. It has some background images, other images, texts, ... It opens correctly in Internet Explorer, but how can I save a word doc as HTML so that Firefox and other current browsers render it correctly?

All images are missing in the document. I looked through the generated html document, but the paths for the images appear to be correct.

Any idea?

Things like "Don't save docs as html" won't be helpful here.

Edit: To make myself clear, the normal "Save as HTML" doesn't cut it, the result is broken in any browser other than Internet Explorer.

Edit 2: What I'm using is Word 2010 and Firefox 4. I also tried rendering it in the latest Chrome version, which failed as well. I used different compatibility settings for saving as html, it did not help

8
  • 2
    Can you please provide a screenshot (or partial screenshot) showing us in what what way it fails?
    – Majenko
    Apr 9, 2011 at 13:02
  • Not of that particular document, I'll describe, if not enough I'll create something new. I have a word doc with background image over the entire page, I have other images at various locations, and I have formatted text on the page. The resulting HTML is a white background, no images, just the formatted text. Apr 9, 2011 at 13:05
  • 2
    using word for html is a horrible idea in general. I'm curious to how uploading it to google docs and using its html output function, or usign OOo/libreoffice to export would work tho
    – Journeyman Geek
    Apr 9, 2011 at 13:21
  • Can't help about the Word doc itself. Google Docs shows the image, but destroys the entire format even more than Word Export does. I didn't try OOo yet, don't have it installed right now Apr 9, 2011 at 13:27
  • Just tested in Open Office (3.2.*). It looks ok in Open Office Writer, but breaks when viewed in a browser Apr 9, 2011 at 13:53

7 Answers 7

6

When using Word Save As Web Page(htm html), just prior to clicking Save, notice the "Tools" drop down to the left of the Save button. Go into this drop down, click the Web Options. In the options box that comes up, UNCHECK the box labeled "Rely on VML..." This worked great for me. Good luck.

1
  • What version of Word did you have? I've looked at 2003 up and they all seem to have "Rely on VML..." unchecked by default.
    – Stephen
    Jun 5, 2014 at 2:56
4

I have a hack that involves modifying HTML code directly. I am using MS-Office 2007 and FF 10.0.4.

The trick is to remove the <v:imagedata src = ...> crud that Word generates when you save a file into HTML and replace that with the standard <img src = ...>. The former (imagedata ...) can only be rendered by IE while the latter is standard and can be handled by all browsers.

Example:

Remove the following -

<span style='mso-no-proof:yes'><v:shape id="Picture_x0020_2" o:spid="_x0000_i1026"
 type="#_x0000_t75" style='width:282.75pt;height:207.75pt;visibility:visible;
 mso-wrap-style:square'>
 <v:imagedata src="dcsl_overview_files/image006.png" o:title=""/>
</v:shape> </span>

With:

<img src="dcsl_overview_files/image006.png" alt="overview figure">
2

I encountered the same issue. It seems that for some reasons Word does export regular HTML for some documents.

Usually Word exports graphics with two codes: a special one for rendering in IE, and regular HTML for the other browsers.

The code looks like below (I removed a lot of the code for readability)

<p ...><span ...><!--[if gte vml 1]><v:shapetype...>
 [code for IE]
</v:shapetype>
<v:shape id="Picture_x0020_2" ... alt="...png" ...>
 <v:imagedata src="...docx_files/image001.png".../>
</v:shape><![endif]-->
<![if !vml]><img width=169 height=119
src="..."... ><![endif]></span></p>

Notice the conditional?

<!--[if gte vml 1]> IE Code <![endif]--> <![if !vml]> Non IE HTML <![endif]>

For some documents I see that Word stops being bilingual and exports only the IE part.

I do not have the solution for these cases yet. Still investigating

2

Try save as Web Page, Filter to remove Office-specific tags. On Word 2007, this clean up all the ugly office tags and generate a clean html file.

1

I've only tried a simple document, rendered in Chrome, so YMMV - but have you tried to save as Web Page, Filtered (available in my copy of Word 2010, and I assume in all versions).

This should strip out a lot of the worst stuff, but still, the output may not always be perfect, browser-neutral HTML.

0

In the quick access toolbar, there is an option called Web page preview. I think this should work (I tested it when I had Word 2007 and don't know if it is available on 2010 and 2013).

-1

As apparently nothing else worked, it became one of these damn "IE only" solutions.

Edit: Just to clarify: I answered this myself as I didn't receive any other answer for 8 months. As I am not in need of the solution any more at the moment, and was too long ago, I will/can not accept another solution.

1
  • Other people may encounter the same issue, including myself. So it is a very useful question. Please be kind enough and mark the answer that you think it solves the problem. Personally, I find @Saurabh Bagchi answer a good solution.
    – Alin C
    Sep 11, 2015 at 7:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .