[Phpwm] instantiate word for windows
alan at dunns.co.uk
Thu Aug 24 09:38:27 BST 2006
Perhaps I can prompt a wider debate.
It seems to me that the area in which php is weakest is printed output.
I take the point that it is a server side language, so we don't have
direct control over what happens at the browser.
But I, and I am sure many of you, need solutions in a commercial
environment - and that means that almost every action results in the
need for a printed page - be it an invoice document, delivery note,
monthly sales report etc. etc. The 'paperless office' doesn't work here.
You _have_ to issue an invoice document - and for business efficiency it
needs to be printed there and then on a printer under the sales counter
that the member of staff is standing at! It seems to me that outputting
a web page to the printer is at best a clumsy solution - reference the
question I raised a couple of months ago about output overrunning the
bottom of a page where there are more lines on screen than a page can
To generate nicely formatted complex monthly summaries I turn to Access
to read our Postgres db and use its reporting facilities with all the
font control spacing, formatting etc it offers - surely I don't have to
resort to that as a solution!
Picking up Phil's specific question - we are running Linux php and no
the output does not have to be Word - Word's mail merge provided a tool
to do a job. I need a pile of letters with variable data and image
objects such as a signature on there.
I will have a look at the RTF options but I would be very interested in
comments on this broader topic.
Phil Beynon wrote:
>> 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
>> 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
>> 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.
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
More information about the Phpwm