Re: IIS and COM
| From: | Alain Samoun | Date: | Fri, 18 Aug 2000 19:48:21 +0000 |
| Subject: | Re: IIS and COM | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-1972@lists.php.net to get a copy of this message | ||
This is the code that works on my machine: Win98 / Apache / PHP4.02-Dev->
Word office 2000
<?php
$word = new COM("word.application") or die("Unable to instantiate Word");
print "Loaded Word, version {$word->Version}<BR>";
$word->Visible = 1;
$word->Documents->Add();
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
$word->Quit(); Comment if you want to see the word document, then close word
manually
?>
Note that the COM functionality is included in the binaries source, ie
nothing shows as extension in php.ini.
Alain
On Fri, Aug 18, 2000 at 03:23:51PM -0400, Matthew Podwysocki wrote:
> On my phpinfo function call, I look into
>
> Directive Local Value Master Value
> allow_dcom Off Off
> typelib_file no value no value
>
> I have found nothing in my php.ini that would seem to indicate COM settings.
> Is there something in that phpinfo that is of some use? I have tried the
> code you sent and I have the same message:
> Loaded word version (8.0b)
> Warning: Invoke() failed: No description available in
> \webroot\lib\comtest.php on line 21
>
> It is the Documents->Add(); function that it seems to have a problem with.
> Thanks!
> Matt Podwysocki
>
>
>
>
> >From: Andy Hoffman <andy.hoffman@bms.com>
> >To: Matthew Podwysocki <gcprweb@hotmail.com>, php-windows@lists.php.net
> >Subject: Re: [PHP-WIN] IIS and COM
> >Date: Fri, 18 Aug 2000 14:50:38 -0400
> >
> >Andy Hoffman wrote:
> >
> > > com_invoke($word, "Document.Add");
> > > com_invoke($word,"Documents[1].SaveAs","Usless_test.doc");
> > >
> > > Mind you, I've never tried these, it's just a guess. Basing this on
> >BASIC
> > > information on php.net - the COM methods are not well documented.
> >
> >OK, I hate it when I'm wrong... but I was wrong. The "COM_invoke" method
> >isn't
> >working on my php4.
> >
> >Matthew, your code (with a properly installed php4) should work... try
> >commenting
> >out lines starting from the end of the script and work your way
> >backwards... find
> >out where the error is occuring. The following script executes on my
> >machine
> >(Apache/php4.0.2dev):
> >
> ><?php
> > $word = new COM("word.application");
> > print "Loaded word version ($word->Version)\n";
> > $word->Visible = 1;
> >
> > $res = $word->Documents->Add();
> >?>
> >
> >Of course, this isn't working PERFECTLY... while I don't get any php
> >errors, the
> >winword process that get's launched never terminates :( (can't even
> >manually
> >kill the process in task list under nt)
> >
> >Anyone else have more experience with the COM code???
> >
> >--
> >Andy Hoffman
> >Web Developer
> >Bristol-Myers Squibb
> >office: LVL G1.2607
> >email: andy.hoffman@bms.com
> >phone: 609-252-5788
> >
> >
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net