COM class (PHP+Word)
Posted: Thu Mar 04, 2004 9:04 am
I use Apache 2.0 and PHP 4.3. on Windows2000.
I want to use Word with PHP and I wrote an example from php.net Manual:
and when I start this code I get two warnings:
Loaded Word, version 8.0
Warning: (null)(): Invoke() failed: Type mismatch. Argument: 2 in D:\Program Files\Apache Group\Apache2\htdocs\word.php on line 13
Warning: (null)(): Invoke() failed: Type mismatch. Argument: 2 in D:\Program Files\Apache Group\Apache2\htdocs\word.php on line 14
I set up com.allow_dcom=true in php.ini.
Could anyone tell me what the problem is ?
I want to use Word with PHP and I wrote an example from php.net Manual:
Code: Select all
<?php
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
echo "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;
?>and when I start this code I get two warnings:
Loaded Word, version 8.0
Warning: (null)(): Invoke() failed: Type mismatch. Argument: 2 in D:\Program Files\Apache Group\Apache2\htdocs\word.php on line 13
Warning: (null)(): Invoke() failed: Type mismatch. Argument: 2 in D:\Program Files\Apache Group\Apache2\htdocs\word.php on line 14
I set up com.allow_dcom=true in php.ini.
Could anyone tell me what the problem is ?