服务器用php生成excel,生成Excel文件范例(1):服务端-PHP教程,PHP应用

ob_start();

?>

xmlns:x="urn:schemas-microsoft-com:office:excel"

xmlns="http://www.w3.org/tr/rec-html40">

{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;}

–>

if(false==isset($_post["data"]))

{

echo    "没有要显示的数据"    ;

exit;

}

?>

collapse;table-layout:fixed;width:389pt>

名称地址qq号电子邮件

foreach($_post["data"] as $val)

{

extract($val)    ;

?>

<?php echo $username ; ?><?php echo $add ; ?><?php echo $qq ; ?> <?php echo $email ; ?>

}

?>

$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    ;

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值