http://agetime.joo.cn/PHPExcel.rar
下载这个类,应该可以帮到你的.

解决方案 »

  1.   

    <?php
    header("Content-type:application/vnd.ms-excel");
    header("Content-Disposition:filename=test.xls");
    这里选出想要的数据
    ?>
    <html>
    <head>
    <meta http-equiv=Content-Type content="text/html; charset=GB2312">
    <style>
    <!--
    .xl24
    {font-size:20.0pt;
    font-family:楷体_GB2312, monospace;
    text-align:center;
    vertical-align:middle;
    white-space:normal;}
    .xl25
    {text-align:center;
    vertical-align:middle;
    border:.5pt solid windowtext;
    white-space:normal;}
    .xl26
    {vertical-align:middle;
    border:.5pt solid windowtext;
    white-space:normal;}
    .xl27
    {text-align:center;
    vertical-align:middle;
    border:.5pt solid windowtext;
    white-space:normal;}
    .xl28
    {font-family:黑体;
    text-align:center;
    vertical-align:middle;
    border:.5pt solid windowtext;
    white-space:normal;}
    .xl29
    {text-align:left;
    vertical-align:middle;
    border:.5pt solid windowtext;
    white-space:normal;}
    -->
    </style>
    </head>
    <body bgcolor="#FFFFFF">
    <table x:str border=0 cellpadding=0 cellspacing=0 width=960>
      <col width=60 style='width:45pt'>
      <col width=300 style='width:225pt'>
      <col width=100 style='width:75pt'>
      <col width=120 style='width:90pt'>
      <col width=100 style='width:75pt'>
      <col width=120 style='width:90pt'>
      <col width=80 span=2 style='width:60pt'>
      <tr height=50> 
        <td colspan=8 height=50 class=xl24 width=960>(2003-12-01) 至 (2003-12-30) 
          收费统计分析</td>
      </tr>
      <tr height=30> 
        <td height=30 class=xl28 width=60>序号</td>
        <td class=xl28 width=300>客户名称</td>
        <td class=xl28 width=100>收费项目</td>
        <td class=xl28 width=120>金额</td>
        <td class=xl28 width=100>方式</td>
        <td class=xl28 width=120>完成时间</td>
        <td class=xl28 width=80>状态</td>
        <td class=xl28 width=80>业务员</td>
      </tr>
    <?php
    For($I = 1;$I < 10 ;$I++)
    {
    ?>
      <tr height=30> 
        <td height=30 class=xl25 width=60 x:num><?=$I?></td>
        <td class=xl26 width=300>a</td>
        <td class=xl25 width=100>b</td>
        <td class=xl26 width=120>c</td>
        <td class=xl25 width=100>d</td>
        <td class=xl29 width=120>e</td>
        <td class=xl27 width=80>f</td>
        <td class=xl25 width=80x:num>g</td>
      </tr>
    <?php
    }
    ?>
      <tr height=26> 
        <td height=26 class=xl28>合计</td>
        <td colspan='2' class=xl26>1元</td>
        <td height=26 class=xl28>制表时间</td>
        <td colspan='2' class=xl26><%=Now()%></td>
        <td height=26 class=xl28>制表人</td>
        <td class=xl26></td>
      </tr>
    </table>
    </body>
    </html>
    <input type='button' value='打印' onclick=""window.open('这个文件名,可以传参数','','left=20,top=20,scrollbars=yes,location=no,toolbar=no,menubar=yes,resizable=yes,status=yes')"">
      

  2.   

    http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php
    纯php写的Class 你会用就可以了。
      

  3.   


    <?php
    require_once '../pearlib/Writer.php';
    // Creating a workbook
    //$workbook = new Spreadsheet_Excel_Writer();
    $workbook = new Spreadsheet_Excel_Writer('test.xls');
    // Creating a worksheet
    $worksheet =& $workbook->addWorksheet('My first worksheet');
    // The actual data
    $worksheet->write(0, 0, 'Name');
    $worksheet->write(0, 1, 'Age');
    $worksheet->write(1, 0, 'John Smith');
    $worksheet->write(1, 1, 30);
    $worksheet->write(2, 0, 'Johann Schmidt');
    $worksheet->write(2, 1, 31);
    $worksheet->write(3, 0, 'Juan Herrera');
    $worksheet->write(3, 1, 32);
    // Let's send the file// Creating a worksheet
    $worksheet =& $workbook->addWorksheet('Second worksheet');
    // The actual data
    $worksheet->write(1, 0, 'Name');
    $worksheet->write(1, 1, 'Age');
    $worksheet->write(2, 0, 'XXX');
    $worksheet->write(2, 1, 28);
    $worksheet->write(3, 0, 'YYY');
    $worksheet->write(3, 1, 10);
    $worksheet->write(4, 0, 'Johnny Walker');
    $worksheet->write(4, 1, 28);
    $workbook->close();print "Excel Test";
    ?>