2013-03-07 07:57



I'm using clean php to draw excel table:

$xls .= "Field\t\Cell1\t\Cell2\tCell3
$xls .= chr(hexdec('FF')) . chr(hexdec('FE')) . $xls; //headers
echo $xls;

Is there any way to draw cell borders without using excel-library?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • duanmao1975 duanmao1975 8年前

    If you really want to output an Excel file with almostly everything possible in Excel, you should use the following easy to use set of PHP classes:

    点赞 评论 复制链接分享
  • douzuita7325 douzuita7325 8年前

    No, you can't control formatting in a CSV file.

    Excel accepts a multitude of formats though, so if you don't feel like breaking out phpexcel, you could create a SpreadsheetML file instead. It's a format quite similar to html and you can control a lot of formatting in there.

    点赞 评论 复制链接分享
  • douzhong3038 douzhong3038 8年前

    Excel has the knowledge to work with plain HTML tables. This will generate a warning from excel, but if you continue, it will show a table with border/colors/etc.

    header('Content-Type: application/');
    <table border='1'>
      <td style='background-color:#f00;'>header</td>
      <td style='background-color:#f00;'>header</td>
    点赞 评论 复制链接分享