1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Export php file to word file

Discussion in 'PHP' started by remosathya, Sep 7, 2010.

  1. remosathya

    remosathya New Member

    Joined:
    Sep 3, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Dear friends,

    i want export the page to word file. Here only the HTML is taking.The php data is not displaying .Why

    Thanks in advance.
     
  2. Max2010

    Max2010 New Member

    Joined:
    Oct 14, 2010
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    0
    Home Page:
    hm you mean that you want the php script to be exported in word?
    you can do like this:

    <?php
    $ExcelFileName="test.doc";
    header("Content-type: application/x-ms-download");
    header("Content-Disposition: attachment; filename=$ExcelFileName");
    header('Cache-Control: public');

    $content=<<<EOD

    echo 'php';
    whatever you want to write here
    including a php script
    it will be included in a string and then
    go in the output for a doc file

    EOD;

    echo $content;
    ?>
     

Share This Page