Forum Moderators: coopster

Message Too Old, No Replies

Write image to Word Doc file

Possible?

         

pboreham

11:36 am on Aug 25, 2005 (gmt 0)

10+ Year Member



Hi all,

I have got my website to produce a report based on a recordset and write it too a .doc file.

I would also like images of products based on the recordset to be added to the .doc file too - is this possible please? If so, how!?

Thanks, Paul.

dive into perl

12:24 pm on Aug 25, 2005 (gmt 0)

10+ Year Member



Hi Paul,

When you say you create a .doc file, do you mean a Word for Windows .doc file?

Well I use the PHP COM functions on Windows to produce Word .doc files, and to insert images I use the InlineShapes->AddPicture function of the Word Object Model.

Below is a PHP code snippet which I use to insert a picture called img.jpg into a table cell.

Hope this helps


$cell->Select();
$cell->InlineShapes->AddPicture('F:\img\img.jpg', FALSE, TRUE);

Paul,

pboreham

12:48 pm on Aug 25, 2005 (gmt 0)

10+ Year Member



Thanks Paul.

Yes, I want to produce a Word document file (.doc).

I am using a Linux Redhat server though, not windows. I assume the same code does not apply.

Any ideas for Linux?

Cheers, paul

coopster

9:55 pm on Aug 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You are correct, COM functions are only available for the Windows version of PHP. Also, you would need to have the MS Word application installed.

I'm not sure if there are any non-Win proprietary options when it comes to making a MS Word doc. Why not use a portable document format (PDF)? That way it works everywhere, you aren't limiting yourself to those folks that cannot open an MS Word doc.