频道直达 - 学院 - 下载 - 交易 - 特效 - 字库 - 手册 -排名-工具- 繁體
网页教学网站开发 设为首页
加入收藏
联系我们
建站搜索: 常用广告代码   用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发设计技术教程 -> PHP教程 -> 生成Excel文件范例(1):服务端

生成Excel文件范例(1):服务端

作者:未知  来源:转载  发布时间:2005-7-21 8:50:46  发布人:acx

减小字体 增大字体

<?php
    ob_start();

?>
<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=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 10">
<link rel=File-List href="Page.files/filelist.xml">
<style id="Book1_10519_Styles">
<!--table
    {mso-displayed-decimal-separator:"\.";
    mso-displayed-thousand-separator:"\,";}
.font510519
    {color:windowtext;
    font-size:9.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;}
.xl1510519
    {padding-top:1px;
    padding-right:1px;
    padding-left:1px;
    mso-ignore:padding;
    color:windowtext;
    font-size:12.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    mso-number-format:General;
    text-align:general;
    vertical-align:middle;
    mso-background-source:auto;
    mso-pattern:auto;
    white-space:nowrap;}
.xl2210519
    {padding-top:1px;
    padding-right:1px;
    padding-left:1px;
    mso-ignore:padding;
    color:windowtext;
    font-size:12.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    mso-number-format:General;
    text-align:general;
    vertical-align:middle;
    border:.5pt solid windowtext;
    background:silver;
    mso-pattern:auto none;
    white-space:nowrap;}
.xl2310519
    {padding-top:1px;
    padding-right:1px;
    padding-left:1px;
    mso-ignore:padding;
    color:windowtext;
    font-size:12.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    mso-number-format:General;
    text-align:general;
    vertical-align:middle;
    border:.5pt solid windowtext;
    mso-background-source:auto;
    mso-pattern:auto;
    white-space:nowrap;}
ruby
    {ruby-align:left;}
rt
    {color:windowtext;
    font-size:9.0pt;
    font-weight:400;
    font-style:normal;
    text-decoration:none;
    font-family:宋体;
    mso-generic-font-family:auto;
    mso-font-charset:134;
    mso-char-type:none;}
-->
</style>
</head>

<body>
<!--[if !excel]>  <![endif]-->
<!--下列信息由 Microsoft Excel 的“发布为 Web 页”向导生成。-->
<!--如果同一条目从 Excel 中重新发布,则所有位于 DIV 标记之间的信息均将被替换。-->
<!----------------------------->
<!--“从 EXCEL 发布 Web 页”向导开始-->
<!----------------------------->

<div id="Book1_10519" align=center x:publishsource="Excel">
<?php
    if(false==isset($_POST["data"]))
    {
        echo    "没有要显示的数据"    ;
        exit;
    }
?>
<table x:str border=0 cellpadding=0 cellspacing=0 width=519 style=''border-collapse:
collapse;table-layout:fixed;width:389pt''>
<col width=72 span=2 style=''width:54pt''>
<col width=163 style=''mso-width-source:userset;mso-width-alt:5216;width:122pt''>
<col width=87 style=''mso-width-source:userset;mso-width-alt:2784;width:65pt''>
<col width=125 style=''mso-width-source:userset;mso-width-alt:4000;width:94pt''>
<tr height=19 style=''height:14.25pt''>
  <td height=19 class=xl1510519 width=72 style=''height:14.25pt;width:54pt''></td>
  <td class=xl1510519 width=72 style=''width:54pt''></td>
  <td class=xl1510519 width=163 style=''width:122pt''></td>
  <td class=xl1510519 width=87 style=''width:65pt''></td>
  <td class=xl1510519 width=125 style=''width:94pt''></td>
</tr>
<tr height=19 style=''height:14.25pt''>
  <td height=19 class=xl1510519 style=''height:14.25pt''></td>
  <td class=xl2210519>名称</td>
  <td class=xl2210519 style=''border-left:none''>地址</td>
  <td class=xl2210519 style=''border-left:none''>QQ号</td>
  <td class=xl2210519 style=''border-left:none''>电子邮件</td>
</tr>
<?php

    foreach($_POST["data"] as $val)
    {
        extract($val)    ;
?>

<tr height=19 style=''height:14.25pt''>
  <td height=19 class=xl1510519 style=''height:14.25pt''></td>
  <td class=xl2310519 style=''border-top:none''><?php echo $username ; ?></td>
  <td class=xl2310519 style=''border-top:none;border-left:none''><?php echo $add ; ?></td>
  <td class=xl2310519 style=''border-top:none;border-left:none''><?php echo $qq ; ?> </td>
  <td class=xl2310519 style=''border-top:none;border-left:none''><?php echo $email ; ?></td>
</tr>
<?php
    }
?>

<![if supportMisalignedColumns]>
<tr height=0 style=''display:none''>
  <td width=72 style=''width:54pt''></td>
  <td width=72 style=''width:54pt''></td>
  <td width=163 style=''width:122pt''></td>
  <td width=87 style=''width:65pt''></td>
  <td width=125 style=''width:94pt''></td>
</tr>
<![endif]>
</table>

</div>


<!----------------------------->
<!--“从 EXCEL 发布 Web 页”向导结束-->
<!----------------------------->
</body>

</html>
<?php
    $outStr=ob_get_contents();
    ob_end_clean();
     
        header("Content-type: application/octet-stream");
        Header("Accept-Ranges: bytes");
        Header("Accept-Length: ".strlen($outStr));
        Header("Content-Disposition: attachment; filename=test.Xls");
        // 输出文件内容          
        echo $outStr    ;
?> 

将本文收藏到QQ书签与更多好友分享
[打 印]
[] [返回上一页] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 要10G免费网络硬盘的请进..
· 通过google 赶快来赚美金..
· 注册码大全十
· 头像-qq头像(qq新头像)4..
· 让你轻松架设FTP服务器1..
· 注册码大全三
· 梦幻背景图片7
· 卡通动物图片6
· 网页制作素材-按钮素材2..
· 让你轻松架设FTP服务器5..
· 风景图片8
· 注册码大全九
· 让你轻松架设FTP服务器2..
关注此文读者还看过
· 利用twig架设WebMail系统..
· 入门教程-模仿物体高速..
· 博客网总裁沈枫辞职 方兴..
· 制作钱币文字效果
· 一个老个写的无组件上传..
· 微软下周二将发布7个补丁..
· 范锋:在探索中前进 Web..
· 完整的站点访问统计系统..
· 鼠绘技法--蜻蜓(3)
· 比尔·盖茨掏腰包解决在..
· JSP语法(12)——<jsp:..
· 用 Photoshop 做残旧的凶..
· 为Html 的Select 加一个..
· Skype推出新服务 可召开..
· 微软XP SP2点邮件升级感..
· [揭密网络黄链]裸聊&网上..
相关文章
· 一个将数据库里面的内容生成..
· php,不用COM,生成excel文..
· php生成EXCEL的东东
· 将数据库里面的内容生成EXC..
· 生成Excel文件范例(1):客户..
· 利用ASP生成EXECL文档
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
粤ICP备05092265号