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. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"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 |