Thread: PHP and COM

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Location
    amsterdam
    Posts
    62
    Rep Power
    14

    tip


    if you want to find out how to call certain functions in word, you can start a 'recording' session, do your stuff and then examine the code the recoder created.

    however, i tried to figure out how to create an unordered list and the recorder created about 30 lines of code for one bullit.

    so the recorder can only point you in the right direction but is still somewhat helpful.

    is it also possible to use DCOM? and how about security on that one?
    you can get anything you want at alices restaurant
  2. #2
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Only works when using a windows web server?


    Hi Devshed, in the article you wrote:

    "I'll assume that you have a working PHP-compliant Web server (either Apache or IIS will do)"

    I've tried the code (I'm running PHP 4.0.4 under Apache) and nothing worked. I found another article on PHP & COM and it stated:

    "Note that this only works when you are running PHP on a Windows Web server."
    http://php.weblogs.com/com_php

    Now, who is right? Or is it because of my PHP version?

    Greetings,

    Barton
  4. #3
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Office Assistant


    I ran the excel code and got nasty errors that each line of code couldn't be run. I opened excel closed the assistant and it worked great.

    Just a tip if anyone else has the same problem.

    I develop in VB so this was great article to read!
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    1
    Rep Power
    0

    [no subject]


    Using PHP to interface with COM objects does have its advantages, but there is a nasty little quirk with doing this that I noticed the other day. I did the Excel and Word examples and then my computer messed up after I had played a game. I did a CTRL-ALT-DEL to bring up the task manager, and under the Processes tab I had noticed that multiple copies of excel.exe and winword.exe were running in the background (I had run the php files more than once obviously) and eating up approximately 8,000 and 7,000 Kb of memory respectively for each copy (there were 8 copies running between the two of them, using up about 60 Mb of RAM total). I clicked on them and hit the 'End Process' button but windows gave me some nasty error messages and would not let me close them (I use Windows 2000, so I'm not sure if it does this in other windows systems, but if I was to take an educated guess I would say that there would still be this problem). The only way that I could remedy this problem was to reboot my computer.
  8. #5
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    _______


    >> Or is it because of my PHP version?

    where can you see the parsing of the word files?
    that script MUST be running on windows server with Word installed ;)
    btw, if there will be 5-10 simultanious request for parsing files to the script-- the ****ty IIS may go down because of the Word ;)
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    1
    Rep Power
    0

    Only on windows


    I guess they assume since the article is about accessing Microsoft COM objects, you would understand it has to be running on a Windows server. This is the case, although I know there are some DCOM implementations that are for Linux and I'm hoping to spend some time trying to access MS COM objects through DCOM from a Linux server. Just for grins.
  12. #7
  13. No Profile Picture
    Ducani
    Guest
    Devshed Newbie (0 - 499 posts)

    PHP and COM


    PHP and COM

    You've already seen how PHP can be used to interface with Java components and JavaBeans. But here's something you didn't know - PHP can (shock shock! horror horror!) even be used to interface with Microsoft COM objects on the Windows platform. Will this be a happy marriage? Read on to find out.

    Please discuss this article in this thread. You can read the article here .
  14. #8
  15. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    Just had a quick look through and it looks quite good. I have used PHP with Outlook and Excel quite a bit and have been doing VB COM programming for a few years now.

    One thing to be wary of is I have seen many tutorials and articles use constants that are predefined in VB but are not available in PHP.

    PHP Code:
     $objApp = new COM("Outlook.Application");
    $myItem $objApp->CreateItem(olMailItem); 
    I just grabbed this off a tutorial site, code doesnt work since 'olMailItem' is not defined. When you want to convert VB code or try and get junk like the above working its good to have MS Access or Excel running with the VB window open and type into the Immediate window in the IDE ?olMailItem which will print out the value of the constant. You then replace the word with the numerical value.
  16. #9
  17. No Profile Picture
    Ducani
    Guest
    Devshed Newbie (0 - 499 posts)
    If you would like to see an article covering a particular topic, please post your request here.

IMN logo majestic logo threadwatch logo seochat tools logo