Posted by gosha bine on 07/30/07 11:43
On 30.07.2007 11:23 Patrick wrote:
> gosha bine a écrit :
>>
>> What does it say if you do
>>
>> com_load_typelib("Word.Application");
>> print_r(preg_grep('/^wd/',
>> array_keys(get_defined_constants())));
>>
>
> The first time I execute it, I got :
>
> Array
> (
> [1032] => wdNoMailSystem
> [1033] => wdMAPI
> [1034] => wdPowerTalk
> [1035] => wdMAPIandPowerTalk
> [1036] => wdNormalTemplate
> [1037] => wdGlobalTemplate
> [1038] => wdAttachedTemplate
> [1039] => wdContinueDisabled
> [1040] => wdResetList
> [1041] => wdContinueList
> [1042] => wdIMEModeNoControl
> .....
> )
>
> and I have no error in Word but from the second execution, I got only
>
> Array
> (
> )
>
> and Word raise the exception.
>
I tried your code on several different php/xp/office combinations and
got everything possible from php exceptions to system crashes. The code
works fine if I remove com_load_typelib and replace wd... constants with
numeric values. This makes me think 'com_load_typelib' is somewhat
unstable and I'd suggest you just get rid of it. Define constants you
need directly in php (you can pull constant definitions out of the OLB
file using oleview or similar tool).
--
gosha bine
makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
[Back to original message]
|