[Phpwm] instantiate word for windows

Phil Beynon phil at infolinkelectronics.co.uk
Tue Aug 22 17:15:59 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.
> http://www.tufat.com/s_html2ps_html2pdf.htm
> Hope this helps
> Dave
> -----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

First thing I'd want to know with a project like this is does it actually
have to be done in Word? - you instantly lose all sorts of control
If its just a template with editable areas can't you use editable iframes on
a page that looks like Word?
That way you retain control and dont end up with all sorts of problems with
say font connectivities being lost.


More information about the Phpwm mailing list