How to display images in Word created from HTML?

I am currently creating a Word document by creating HTML and modifying the header information to display as a .doc file. This is a bad person’s method, but it works fine (so far).

I just asked to include the image in the file. My best idea was for base64 to embed an image. This works fine in a browser, however Word just gives me a box with an X in it.

Suggestions on how I can embed an image in this file and display it in Microsoft Word?

+7
html ms-word base64
source share
2 answers

This is a difficult question, Word is not capable of processing data: base64 encoded images in HTML, at least that result in this question and discussion in MSDN .

You have three options:

  • Create a folder at the location of the document, save it next to the document and compare the reference images ( <img src='imageFolder/image1.jpg'> )

  • Work with absolute URLs or file paths (suck even more)

  • Look at the new Word> 2003 XML-based format , it is definitely possible there.

The only other possibility that I can think of is actually creating my own Word file, for example. using OpenOffice.

+11
source share

I just achieved this by printing DOCX to PDF and then using Acrobat to save as in HTML. The images looked small but there.

+1
source share

All Articles