怎么去把这些格式添加到cell中呢?很简单,我们只需要把样式添 加到对应的标签对(即闭合标签)即可。如<td></td>,给标签对<td></td>添加样式,如 下: <td  style="vnd.ms-excel.numberformat:@">410522198402161833</td>
同样,也可以给<div></div>添加样式,也可以给<tr>< /tr>,<table></table>添加样式;
当在父标签对和子标签对都添加样式时,数据会以哪一个样式呈现 呢?
经过测试,会以离数据最近的样式呈现。
echo "<td style='vnd.ms-excel.numberformat:@'>".$printable."</td>n";
$filename=
iconv("UTF-8", "GB2312//IGNORE","会员名.xls");//date('Y-m-d-H-i-s').".xls";
header("Content-type:application/vnd.ms-excel");
 Header("Accept-Ranges:bytes");
 Header("Content-Disposition:attachment;filename=".$filename); //$filename导出的文件名
 header("Pragma: no-cache");
 header("Expires: 0");
echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns="http://www.w3.org/TR/REC-html40">
 <head>
    <meta http-equiv="expires" content="Mon, 06 Jan 1999 00:00:01 GMT">
    <meta http-equiv=Content-Type content="text/html; charset=gb2312">
    <!--[if gte mso 9]><xml>
    <x:ExcelWorkbook>
    <x:ExcelWorksheets>
      <x:ExcelWorksheet>
      <x:Name></x:Name>
      <x:WorksheetOptions>
        <x:DisplayGridlines/>
      </x:WorksheetOptions>
      </x:ExcelWorksheet>
    </x:ExcelWorksheets>
    </x:ExcelWorkbook>
    </xml><![endif]-->
</head>';
echo "<table><tr>
      <th>".iconv("UTF-8", "GB2312//IGNORE","会员名")."</th>
      <th>".iconv("UTF-8", "GB2312//IGNORE","账号")."</th>
      <th>".iconv("UTF-8", "GB2312//IGNORE","联系人")."</th>
</tr>";
 foreach ($list as $v) 
 {
      echo "<tr>";
      echo "<td>".iconv("UTF-8", "GB2312//IGNORE", $v["user_name"])."</td>";
      echo "<td style='vnd.ms-excel.numberformat:@'>".$v["account_id"]."</td>";
      echo "<td>".iconv("UTF-8", "GB2312//IGNORE", $v["contact_name"])."</td>";
  echo "</tr>";
 }
 echo "</table>";