Hello guys,

I have a small dynamic website and I'm showing, updating, searching data from MySQL tables using PHP and HTML of course. So I show my DB data in HTML. But, now I want do show my data also in MS WORD or EXCEL.
I want to generate MS WORD/EXCEL file with PHP and when user clicks a button "Show me this page in MS WORD", PHP will get data from DB and make MS WORD file where data are formated in some way to look nice.

Is it possible with PHP? In JSP I did that very easy (in one line - configurating page header - application type), and IE can read Word and Excel files easy.
Please give any clues or some article to read.

Thanks

    a month later

    pretty bad coding style but.....

    <?php
    Header('ContentType: application/vnd.ms-excel');
    ?><table>
    <tr>
    <td>1</td>
    <td>2</td>
    </tr>
    <tr>
    <td>3</td>
    <td>4</td>
    </tr>
    <tr>
    <td colspan="2">=SUM(A1;B2)</td>
    </tr>
    </table>

    hope this helps

      Write a Reply...