Re: load word document with php

From: Date: Tue, 30 Nov 2004 13:51:31 +0000
Subject: Re: load word document with php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203143@lists.php.net to get a copy of this message
On Tuesday 30 November 2004 21:35, Thomas Franz wrote: > i hope this is the right newsgroup. > I start working with php. Now, i want loading worddocuments into the with > php, change/add some text and save this changes. I found following simple > example. > > <?php > $word=new COM("word.application") or die("Cannot start word for you"); > $word->visible = 1 ; > $word->Documents->Open("Test.doc"); > $word->Selection->TypeText("Hello World"); > $word->Documents[1]->SaveAs("New Test.doc"); > $word->ActiveDocument->Close(false); > $word->Quit(false); > $word->Release(); > $word = null; > ?> > No error occurs and the new word Document is saved with the changes, but i > don't see the document within the webbrowser. > > What is wrong. How are you trying to view the document in the browser? I've no experience with programming COM objects under Windows but it looks (obvious?) to me that there is no code there to output the saved document to the browser. To output an arbitary file to the browser you can use fopen() and fpassthru(). But for the browser to make some sense of it you should use header() to output the appropriate headers - see manual for examples (and look at the user contributed notes on the online manual for even more examples). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Live from New York ... It's Saturday Night! */

« previous php.general (#203143) next »