Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Thanked 0 Times in 0 Posts

    Question using PHP's COM extension

    Hi everyone,

    I have this code:
    $excel = new COM("Excel.Application" ) or Die ("Did not connect" );
    $excel->Visible = 1;
    $wkbs = $excel->Workbooks->Add();
    $sheet =$wkbk->ActiveSheet;
    $excel->application->ActiveWorkbook->Close("False" );
    unset ($excel);

    it runs and an instance of excel.exe is created, but I don't see the app. I thought the visible property showed like it would if you would manually start excel.

    I have also tried using:
    $excel->application->visible = 1;
    No joy still

    Please help someone. I am working with PHP4/Apache 1.3 on XP


  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 101 Times in 99 Posts
    Hi , COM is useful , but when used as part of a PHP web-based script the idea is not really to show the interface (many COM applications dont even have an interface) .

    Its more for say , passing data to an instance of Word or Excel and then get Word or Excel to save/manipulate that data in is native format, or whatever functionality your COM object provides.

    If you want to actually see the thing you need to drop out of the webserver , eg , save your script as (eg call it whaever you want ) comtest.php.sh

    then open notepad and save the following but with your own paths to PHP and the script... as comtest.bat (save it anywhere)

    c:\phpdev\php\php-4.3.3\php.exe -f e:\phpdev\www\comtest.php.sh

    then double click the .bat file and you should see excel and that stupid paperclip (actually I think the paperclip does not work here unless invoked but I dunno for sure cos I terminated mine ages ago )
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts