php导出到excel不显示网格线

gog*_*ogu 7 php excel

我有这个代码

<?php
header("Content-type: application/vnd.ms-excel; name='excel'");

header("Content-Disposition: filename=export.xls");
// Fix for crappy IE bug in download.
header("Pragma: ");
header("Cache-Control: ");
echo $_REQUEST['datatodisplay'];
?>
Run Code Online (Sandbox Code Playgroud)

它将来自html表的数据放入excel,但唯一的问题是我没有看到表格中的网格线.我错过了什么吗?谢谢

小智 1

确保您没有background-color为 HTML<BODY>标记定义“”属性。那是我的问题。删除它,所有网格线都会神奇地重新出现在 Excel 中。