Posted by gosha bine on 07/29/07 22:16
Patrick wrote:
> 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
What does it say if you do
com_load_typelib("Word.Application");
print_r(preg_grep('/^wd/',
array_keys(get_defined_constants())));
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
[Back to original message]
|