You are here: Re: Use of OLE constants in PHP « PHP Programming Language « IT news, forums, messages
Re: Use of OLE constants in PHP

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация