Re: load word document with php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux