php to word.

This is a discussion on php to word. within the PHP Language forums, part of the PHP Programming Forums category; I want to write to file in word, but the second line is wrong. Cannot call tht illegal function COM. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-13-2003
Espen
 
Posts: n/a
Default php to word.

I want to write to file in word, but the second line is wrong. Cannot call
tht illegal function COM.
Any Idea??


<?php
$word=new COM("Word.Application") or die("Cannot start word for you");
print "Loaded word version ($word->Version)\n";

$word->visible =1 ;
$word->Documents->Add();
$word->Selection->Typetext("Writing This Message ....");
$word->Documents[1]->SaveAs("c:\just_a_test2.doc");
$word->Quit();
print "Done ...........\n";
?>

Thanks in advance


Reply With Quote
  #2 (permalink)  
Old 08-13-2003
Nikolai Chuvakhin
 
Posts: n/a
Default Re: php to word.

"Espen" <ekvalhei@online.no> wrote in message
news:<bhdc35$6km$1@news.tdcnorge.no>...
>
> I want to write to file in word,


Consider generating RTF instead. Cleaner, simpler, no need to use
COM (hence, better use of system resources), totally cross-platform,
read by Word (and a host of other word processors) without a problem...

> but the second line is wrong. Cannot call tht illegal function COM.
> Any Idea??


What happens if you try:

$com = com_load ('Word.Application');

From the docs, it seems like the COM object is a much newer addition,
while com_* functions were there for a while. It is possible that
your version of PHP simply doesn't support the COM class...

Cheers,
NC
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0