本帖最后由 zjisou5 于 2011-09-01 13:39:43 编辑

解决方案 »

  1.   

    你输出一个表格,可以控制宽度的啊。
    echo "<td width='...'>";
      

  2.   

    用用phpExcel吧,用法比较麻烦,但值得研究。
      

  3.   


    while(($order=mysql_fetch_array($query)) != false){
    echo "<td width='50'>" $order['name']."\t"; 
    echo "<td width='50'>" $order['tel']."\t"; 
    echo "<td width='50'>" $order['note']."\t";
    echo "<td width='50'>" $order['city']."\t"; 
    echo "<td width='50'>" $order['comedate']."\n"; 改了就出错了,请教哪里出错了啊,前辈能写个示范吗?
      

  4.   

    echo "<table>";
    while(($order=mysql_fetch_array($query)) != false){
    echo "<tr>";
    echo "<td width='50'>" $order['name']."</td>"; 
    echo "<td width='50'>" $order['tel']."</td>"; 
    echo "<td width='50'>" $order['note']."</td>";
    echo "<td width='50'>" $order['city']."</td>"; 
    echo "<td width='50'>" $order['comedate']."</td>"; 
    echo "<tr>";
    }
    echo "</table>";
      

  5.   

    echo "<table>";
    while(($order=mysql_fetch_array($query)) != false){
    echo "<tr>";
    echo "<td width='50'>". $order['name']."</td>"; 
    echo "<td width='50'>" .$order['tel']."</td>"; 
    echo "<td width='50'>". $order['note']."</td>";
    echo "<td width='50'>" .$order['city']."</td>"; 
    echo "<td width='50'>" .$order['comedate']."</td>"; 
    echo "<tr>";
    }
    echo "</table>";
      

  6.   

    你这是输出csv文件吧,宽度不能设置,用phpExcel可以导出excel格式的
      

  7.   


    老大,这样改了输出还是有点问题, </td>都被输出了....
      

  8.   


    前辈我是输出的EXCEL格式的文件,是不是不能这样搞啊?
      

  9.   

    这样用\t分割字段的话,excel会填充表格而不会自动设置宽度。
     用table的话应该是可以的:echo "<table>";
    while(($order=mysql_fetch_array($query)) != false){
    echo "<tr>
            <td width='50'>{$order['name']}</td> 
            <td width='50'>{$order['tel']}</td> 
            <td width='50'>{$order['note']}</td>
            <td width='50'>{$order['city']}</td> 
            <td width='50'>{$order['comedate']}</td> 
          <tr>";
    }
    echo "</table>";
      

  10.   

    table{width:80%; margin:0 auto; border:1px double #ccc;}
    td{width:20%;}
    乱写。
      

  11.   


    都说PHPEXCEL,用那个是不是有点杀鸡用牛刀了啊
      

  12.   

    看来LZ 要多学习了 依赖性很强啊 。你EXCEL 格式都导出来了,设置个宽度就更简单了吧
      

  13.   

    你用的是什么 操作 导出 excel 的类呢?