应该不是html的问题 如果我加一个<td>a</td>就出现乱码,如果不加则显示正常。是不是excel保存有列的限制啊 大家帮我想想办法哦

解决方案 »

  1.   

    // 如果设置为 GetEncoding("GB2312");导出的文件将会出现乱码!!!
        Response.ContentEncoding = System.Text.Encoding.UTF7;
      

  2.   

    <?php
      include "function.inc"; 
      header("Content-type: application/vnd.ms-excel 5.0");
    header("Content-Disposition: filename=operator_value.xls");
    header("Content-Description: operator_value");
      $conn=0;
      $donotclose=1;
      $packname="operator_value_download.phtml";
    echo "
    <STYLE>
    BODY {
    SCROLLBAR-FACE-COLOR: #a8cbf1; 
    SCROLLBAR-HIGHLIGHT-COLOR: #a8cbf1;
     SCROLLBAR-SHADOW-COLOR: #a8cbf1; 
     SCROLLBAR-3DLIGHT-COLOR: #ffffff; 
     SCROLLBAR-ARROW-COLOR: #ffffff; 
     SCROLLBAR-TRACK-COLOR: #a8cbf1; 
     SCROLLBAR-DARKSHADOW-COLOR: #ffffff; 
     SCROLLBAR-BASE-COLOR: #a8cbf1; 
     BACKGROUND-COLOR: #f2fafd
    }
    TABLE {
    FONT-SIZE: 9pt;
    }
    </STYLE>
    <BODY background=images/bg.gif>
    <CENTER>
    <P></CENTER>
    <P>
    ";echo "                          
        <P><CENTER><BR>             
       <strong><font color=#0000FF>局向:$county_name 营业厅:$yyt (org_id=$org_name) $day 日<font color=#FF0099> 营业员积分</font></strong>  
       <table  borderColor=#CC6600 width=2000 border>
       <tr>
       <th rowspan=2 bgcolor=#FFEEE6 width=40><div align=center>1</div></th>
          <th rowspan=2 bgcolor=#FFEEE6 width=40><div align=center>1</div></th>
          <th rowspan=2 bgcolor=#FFEEE6 width=60><div align=center>1</div></th>
         <th rowspan=2 bgcolor=#FFEEE6 width=60><div align=center>1</div></th>
         <th colspan=3 bgcolor=#CCFFFF width=60><div align=center>1</div></th>
           <th colspan=4 bgcolor=#FFEEE6 width=60><div align=center>1</div></th>
           <th colspan=4 bgcolor=#D7FFD7 width=60><div align=center>1</div></th>
           <th colspan=1 bgcolor=#cccccc width=60><div align=center>1</div></th>
           <th colspan=4 bgcolor=#ACEDF9 width=60><div align=center>1</div></th>
           <th colspan=1 bgcolor=#cccccc width=60><div align=center>1</div></th>
           <th rowspan=2 bgcolor=#ACEDF9 width=60><div align=center>1</div></th>
           <th colspan=19 bgcolor=#FFEEE6 width=60><div align=center>1</div></th>
           <th rowspan=2 bgcolor=#cccccc width=60><div align=center>1</div></th>
      </tr>
     <th bgcolor=#CCFFFF align=center nowrap>1</th>
       <th bgcolor=#CCFFFF align=center nowrap>1</th>
       <th bgcolor=#CCFFFF align=center nowrap>1</th>
       <th bgcolor=#FFEEE6 align=center nowrap>1</th>
       <th bgcolor=#FFEEE6 align=center nowrap>1</th>
       <th bgcolor=#FFEEE6 align=center nowrap>1</th>
       <th bgcolor=#FFEEE6 align=center nowrap>1</th>
       <th bgcolor=#D7FFD7 align=center nowrap>1</th>
       <th bgcolor=#D7FFD7 align=center nowrap>1</th>
       <th bgcolor=#D7FFD7 align=center nowrap>1</th>
       <th bgcolor=#D7FFD7 align=center nowrap>1</th>
       <th bgcolor=#cccccc align=center nowrap>1</th>
       <th bgcolor=#ACEDF9 align=center nowrap>1</th>
       <th bgcolor=#ACEDF9 align=center nowrap>1</th>
           <th bgcolor=#ACEDF9 align=center nowrap>1</th>
           <th bgcolor=#ACEDF9 align=center nowrap>1</th>
           <th bgcolor=#cccccc align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1/th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           <th bgcolor=#FFEEE6 align=center nowrap>1</th>
           在此添加报错 请各位看看
          </tr>      
      ";
      

  3.   

    我的程序到这一步的时候有错:
    $excel = new COM("Excel.sheet") or Die ("Did not instantiate Excel");// 建立EXCEL的COM对象错误信息:
    Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Excel.sheet': 拒绝访问。 ' in E:\iis\libraire\excel\excel.php:40 Stack trace: #0 E:\iis\libraire\excel\excel.php(40): com->com('Excel.sheet') #1 E:\iis\libraire\excel\testclass.php(28): Excel->excel() #2 {main} thrown in E:\iis\libraire\excel\excel.php on line 40
    我用的IIS(6.0)+windows 2003 server
    我的QQ:531515035
    email :jiehan126.com
    谢谢指点