php to word.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Espen

    php to word.

    I want to write to file in word, but the second line is wrong. Cannot call
    tht illegal function COM.
    Any Idea??


    <?php
    $word=new COM("Word.Appli cation") or die("Cannot start word for you");
    print "Loaded word version ($word->Version)\n";

    $word->visible =1 ;
    $word->Documents->Add();
    $word->Selection->Typetext("Writ ing This Message ....");
    $word->Documents[1]->SaveAs("c:\jus t_a_test2.doc") ;
    $word->Quit();
    print "Done ...........\n";
    ?>

    Thanks in advance


  • Nikolai Chuvakhin

    #2
    Re: php to word.

    "Espen" <ekvalhei@onlin e.no> wrote in message
    news:<bhdc35$6k m$1@news.tdcnor ge.no>...[color=blue]
    >
    > I want to write to file in word,[/color]

    Consider generating RTF instead. Cleaner, simpler, no need to use
    COM (hence, better use of system resources), totally cross-platform,
    read by Word (and a host of other word processors) without a problem...
    [color=blue]
    > but the second line is wrong. Cannot call tht illegal function COM.
    > Any Idea??[/color]

    What happens if you try:

    $com = com_load ('Word.Applicat ion');

    From the docs, it seems like the COM object is a much newer addition,
    while com_* functions were there for a while. It is possible that
    your version of PHP simply doesn't support the COM class...

    Cheers,
    NC

    Comment

    Working...