php输出excel文件

来源:互联网 发布:查分软件 编辑:程序博客网 时间:2024/05/01 01:07
------------------------------------------------ excel_export.php ----

<?php
header('Content-Type: application/vnd.ms-excel; charset=GBK');
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: filename=test.xls');
?>

<html>
<style>
TD{
    font-size: 12px;
    vertical-align: middle;

}
strong{
    font-size: 14px;

}
</style>
<!--HTML中td元素的nowrap属性表示禁止单元格中的文字自动换行-->
<body>
<div><b>统考报名督促</b></div>
<table width="100%" border="1" align="center" cellspacing="1" cellpadding="1">
  <tr align="center">
    <td nowrap><b>序号</b></td>
    <td nowrap><b>学生姓名</b></td>
    <td nowrap><b>服务站</b></td>
    <td nowrap><b>学籍批次</b></td>
    <td nowrap><b>层次</b></td>
    <td nowrap><b>专业</b></td>
    <td nowrap><b>联系电话</b></td>
    <td nowrap><b>手机</b></td>
    <td nowrap><b>大学英语(B)</b></td>
    <td nowrap><b>计算机应用基础</b></td>
    <td nowrap><b>大学语文(A)</b></td>
    <td nowrap><b>大学语文(B)</b></td>
    <td nowrap><b>高等数学(B)</b></td>
  </tr>
  <tr align="center">
    <td nowrap>1</td>
    <td nowrap>qifei</td>
    <td nowrap>山东教学服务中心</td>
    <td nowrap>200509</td>
    <td nowrap>高起本</td>
    <td nowrap>计算机科技</td>
    <td nowrap>010-10101010</td>
    <td nowrap>13233333333</td>
    <td nowrap>通过</td>
    <td nowrap>未通过</td>
    <td nowrap>通过</td>
    <td nowrap>未通过</td>
    <td nowrap>免考</td>
  </tr>
  <tr align="center">
    <td nowrap>2</td>
    <td nowrap>qifei</td>
    <td nowrap>山东教学服务中心</td>
    <td nowrap>200509</td>
    <td nowrap>高起本</td>
    <td nowrap>计算机科技</td>
    <td nowrap>010-10101010</td>
    <td nowrap>13233333333</td>
    <td nowrap>通过</td>
    <td nowrap>未通过</td>
    <td nowrap>通过</td>
    <td nowrap>未通过</td>
    <td nowrap>免考</td>
  </tr>
</table>
<br>
<b>说明:</b><br>
1、china qifei<br>
2、Tianjin University<br>
</body>
</html>
------------------------------------------------ excel_export.php ----

其他格式文件:

header("Content-type:application/vnd.ms-word");   
header("Content-Disposition:filename=test.doc");
 
header("Content-type:application/vnd.ms-excel");   
header("Content-Disposition:filename=test.xls");
  
header("Content-type:application/vnd.ms-PowerPoint");   
header("Content-Disposition:filename=test.ppt");
原创粉丝点击