Are you asking for a php code that generate a MSWORD document with image in it,can you explain a lil bit more Regards Alex
As far as I know, it's very difficult if not impossible for PHP. M$ binary format is very complex, so even openoffice and abiword can not read it 100% correct. If you use java, you may take a look at Apache POI (http://poi.apache.org/). If you use c, you may take a look at wvware(wvware.sourceforge.net/).
I've done it successfully with PHP, but it required hundreds of lines of code so I'm not going to attempt to go into great detail here. The easiest way is to duplicate Word's "single file HTML" document format, which is basically a MIME package containing the document in Word's spastic HTML plus all the images and related resources. If you create a document in Word and save it in that format, you can open it in a text editor and see how it looks. From then it's just a straightforward matter of reverse-engineering.
Do you mean the "single file HTML" document format, or the true .doc format? Mind share your php code?
It's the single-file HTML format, but from the perspective of a Word user, it's indistinguishable. You can name the file xxxx.doc and Word will open it. It supports all the features of a Word document, including embedded images, change tracking, and so on. Unfortunately I cannot share the code as I was paid some $30K to develop the software of which it's a component, and I don't own it. But as I mentioned above, you can easily reverse engineer the format by looking at a few saved files. There's also some documentation online at the Microsoft site, but frankly, I found that tinkering with files, saving them in Word, and looking at the results in a text editor was a lot more helpful.
In a nutshell, it's a bunch of template substitution, plus some extra work to assemble the MIME components.