[Phpwm] instantiate word for windows

Dave Holmes Dave at neteffekt.co.uk
Tue Aug 22 14:12:05 BST 2006

Hi Alan, 

This is not something that you can do with PHP as it is strictly a server
side language. There is a change you could do it with embedded vbscript or
javascript in a browser but you will end up in a world of security issues
and instability. 

The most elegant solution for doing this is to generate the word document on
the server and then push the content to the browser as a download, there are
a number of ways you can do this. 

If you are running on a Windows version server with PHP and office installed
you can control word using the standard COM or NET objects, create your
document and save to the file system. You can then use the fpassthru command
to dump it to the browse. The command help with give you the info you need
on setting http headers for downloads. 

The second option is to use an RTF generation class to create basic content
which can be loaded into word, if you hit google with "PHP RTF class" there
are quite a few around. 

I must admit this is not something I have every attempted to do, or wanted
to do come to that as we always tend to generate PDF files from PHP, if you
want to do that there is an excellent library you can use.

Hope this helps 


-----Original Message-----
From: phpwm-bounces at mailman.lug.org.uk
[mailto:phpwm-bounces at mailman.lug.org.uk] On Behalf Of alan dunn
Sent: 22 August 2006 14:08
To: phpwm
Subject: [Phpwm] instantiate word for windows

Hi all,
sorry to use such bad language, but is it possible to instantiate Word (or
other MS programmes come to that) from within a php page and then preferably
feed it some opening information such as which file to open?

I want to automate a letter writing process from one of several standard
letters based on a db selection.

regards, alan dunn

Phpwm mailing list
Phpwm at mailman.lug.org.uk

More information about the Phpwm mailing list