Reply to Use of OLE constants in PHP

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на 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

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