By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,965 Members | 1,702 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,965 IT Pros & Developers. It's quick & easy.

php to word.

P: n/a
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
Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Espen" <ek******@online.no> wrote in message
news:<bh**********@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
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.