文章导航PC6首页软件下载单机游戏安卓资源苹果资源

pc软件新闻网络操作系统办公工具编程服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯苹果手机越狱备份教程美化教程ios软件教程mac教程

单机游戏角色扮演即时战略动作射击棋牌游戏体育竞技模拟经营其它游戏游戏工具

网游cf活动dnf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:首页网页设计PHP技巧 → php生成EXCEL的东东

php生成EXCEL的东东

时间:2004/11/7 3:15:00来源:本站整理作者:蓝点我要评论(0)

可以通过PHP来产生EXCEL档.  teaman翻译

----------------------------

Excel Functions

----------------------------

将下面的代码存为excel.php ,然后在页面中包括进来



然后调用

1. Call xlsBOF()  

2. 将一些内容写入到xlswritenunber() 或者 xlswritelabel()中.

3.然后调用 Call xlsEOF()



也可以用 fwrite 函数直接写到服务器上,而不是用echo 仅仅在浏览器上显示。

   






// ----- begin of function library -----

// Excel begin of file header

function xlsBOF() {

    echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);  

    return;

}

// Excel end of file footer

function xlsEOF() {

    echo pack("ss", 0x0A, 0x00);

    return;

}

// Function to write a Number (double) into Row, Col

function xlsWriteNumber($Row, $Col, $Value) {

    echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);

    echo pack("d", $Value);

    return;

}

// Function to write a label (text) into Row, Col

function xlsWriteLabel($Row, $Col, $Value ) {

    $L = strlen($Value);

    echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);

    echo $Value;

return;

}

// ----- end of function library -----

?>



//  

// To display the contents directly in a MIME compatible browser  

// add the following lines on TOP of your PHP file:




header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");

header ("Cache-Control: no-cache, must-revalidate");     

header ("Pragma: no-cache");     

header ('Content-type: application/x-msexcel');

header ("Content-Disposition: attachment; filename=EmplList.xls" );  

header ("Content-Description: PHP/INTERBASE Generated Data" );

//

// the next lines demonstrate the generation of the Excel stream

//

xlsBOF();   // begin Excel stream

xlsWriteLabel(0,0,"This is a label");  // write a label in A1, use for dates too

xlsWriteNumber(0,1,9999);  // write a number B1

xlsEOF(); // close the stream

?>


相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 如何恢复Discuz!7.0被 CSS实现Tab技巧Linux配置DHCP服务器实例:linux配置教程如何在IIS7下设置支持PHP程序PHP技巧--通过COM使用ADODB

人气排行 dedecms数据库表和字段说明最小化数据传输——在客户端存储数据php如何自动跳转中英文页面如何在IIS7下设置支持PHP程序php批量获取首字母(汉字、数字、英文)经典php实现大文件上传源代码Windows环境PHP的session不能正常使用解决办PHP聊天室技术