how to use php to include an image in a word file?

Posted by altvali on Stack Overflow See other posts from Stack Overflow or by altvali
Published on 2010-06-15T15:41:31Z Indexed on 2010/06/15 15:42 UTC
Read the original article Hit count: 224

Filed under:
|
|
|

Hi all!

Somebody has asked me to make an app in php that will generate a .doc file with an image and a few tables in it. My first approach was:

somethingsomething else


cevaaltceva'); fclose($fh); ?>

This uses the data uri technique of embedding an image.

This will generate an html file that will be rendered ok in web browsers but the image is missing in Microsoft Office Word, at least in the standard setup. Then, while editing the file with Word, i've replace the image with an image from file and Microsoft Word changed the contents of the file into Open XML and added a folder, new_files where he put the imported image (which was a .png), a .gif version of the image and a xml file:

 
   
   
   
  

Now this isn't good enough either since i want this to be all kept in a single .doc file. Is there a way to embed an image in an OpenXML-formatted .doc file?

Any help will be much appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about word