note 60306 added to class.com
| From: | candy at teamrise dot com dot tw | Date: | Tue, 03 Jan 2006 08:55:40 +0000 |
| Subject: | note 60306 added to class.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101129@lists.php.net to get a copy of this message | ||
i am call COM, my script
<?php
// starting word
$word = new COM("Excel.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}n";
//bring it to front
$word->Visible = 1;
//open an empty document
$word->Documents->Add();
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//closing word
$word->Quit();
//free the object
$word->Release();
$word = null;
?>
but test it. show
Loaded Word, version 11.0n
Fatal error: Uncaught exception 'com_exception' with message 'Error
Qs¬õB ' in D:\TRSMTP\www\word.php:20 Stack trace: #0
D:\TRSMTP\www\word.php(20): com->Release() #1 {main} thrown in D:\TRSMTP\www\word.php on line 20
why?
----
Manual Page -- http://www.php.net/manual/en/class.com.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60306
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60306&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60306&report=yes
Search -- http://master.php.net/manage/user-notes.php