Posted by Patrick on 07/29/07 16:55
Hello,
I try to create a Word document from PHP.
I use the COM class to create the Word object and the methods and
properties of the object ot access it.
No problem until I use the predefined constants of Word as parameter of
methods or value of properties : I get an exception in PHP.
Here is my code :
com_load_typelib("Word.Application");
$word = new COM("Word.Application");
$doc = $word->Documents->Add();
$doc->Activate();
$doc->Select();
$word->ActiveDocument->PageSetup->Orientation = wdOrientLandscape;
$word->Selection->TypeText("CRs monitoring for product $product");
$doc->Close(wdDoNotSaveChanges);
$word->Quit();
$word = null;
unset($word);
This code produce an exception with the following error message :
"Parameter 0: Le type ne correspond pas" (the type does not correspond)
on the line with the constant "wdOrientLandscape".
I tried with and without the instruction "com_load_typelib", the result
is the same !
Could you explain what I must do to use OLE in PHP ?
For information I use Win XP, Office XP and PHP 5.2.3.
Thanks by advance.
Patrick
[Back to original message]
|