php生成EXCEL的东东
来源:互联网 发布:java开发小游戏教程 编辑:程序博客网 时间:2024/05/17 22:53
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
----------------------------
EXCEL Functions
----------------------------
将下面的代码存为EXCEL.php ,然后在页面中包括进来
然后调用
1. Call xlsBOF()
2. 将一些内容写入到xlswritenunber() 或者 xlswritelabel()中.
3.然后调用 Call xlsEOF()
也可以用 fwrite 函数直接写到服务器上,而不是用echo 仅仅在浏览器上显示。
<?php
// ----- 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:
<?php
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
?>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
可以通过php来产生EXCEL档. teaman翻译 ----------------------------
EXCEL Functions
----------------------------
将下面的代码存为EXCEL.php ,然后在页面中包括进来
然后调用
1. Call xlsBOF()
2. 将一些内容写入到xlswritenunber() 或者 xlswritelabel()中.
3.然后调用 Call xlsEOF()
也可以用 fwrite 函数直接写到服务器上,而不是用echo 仅仅在浏览器上显示。
<?php
// ----- 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:
<?php
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
?>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- php生成EXCEL的东东
- php的东东
- PHP开发常用的东东
- PHP 生成excel|好用强大的php excel类库
- PHP生成Excel,然后另存为的方法
- 基于Spreadsheet的php生成excel
- 简单的php生成EXCEL类
- php生成excel的方法一
- php生成excel文件的多种方法
- PHP生成EXCEL表格
- php生成EXCEL文件
- PHP生成EXCEL
- PHP生成EXCEL
- php生成excel文档
- php生成excel文件
- PHP生成EXCEL报表
- php生成excel报表
- php生成excel报表
- 关于如何添加一个自增的列【原创】
- 用PHP实现多级树型菜单
- C#慢慢学 (一)(e文转)
- 生成sessionid和随机密码的例子
- page_Load和page_Init的区别
- php生成EXCEL的东东
- 使用C#开发用户控制(转)
- PHP中对数据库操作的封装
- 我写的上传(upload)文件的codebehind代码(1gdt)
- 一个取得文件扩展名的函数
- C# 积木模块 ABC(二)在C#中部署应用程序
- 用ODBC的分页显示
- ASP.NET中异常处理使用(详细)
- 为查询结果建立向后/向前按钮