php生成EXCEL的东东
2023-06-13 09:13:44 时间
可以通过PHP来产生EXCEL档. teaman翻译
----------------------------
ExcelFunctions
----------------------------
将下面的代码存为excel.php,然后在页面中包括进来
然后调用
1.CallxlsBOF()
2.将一些内容写入到xlswritenunber()或者xlswritelabel()中.
3.然后调用CallxlsEOF()
也可以用fwrite函数直接写到服务器上,而不是用echo仅仅在浏览器上显示。
<?php
//-----beginoffunctionlibrary-----
//Excelbeginoffileheader
functionxlsBOF(){
echopack("ssssss",0x809,0x8,0x0,0x10,0x0,0x0);
return;
}
//Excelendoffilefooter
functionxlsEOF(){
echopack("ss",0x0A,0x00);
return;
}
//FunctiontowriteaNumber(double)intoRow,Col
functionxlsWriteNumber($Row,$Col,$Value){
echopack("sssss",0x203,14,$Row,$Col,0x0);
echopack("d",$Value);
return;
}
//Functiontowritealabel(text)intoRow,Col
functionxlsWriteLabel($Row,$Col,$Value){
$L=strlen($Value);
echopack("ssssss",0x204,8+$L,$Row,$Col,0x0,$L);
echo$Value;
return;
}
//-----endoffunctionlibrary-----
?>
//
//TodisplaythecontentsdirectlyinaMIMEcompatiblebrowser
//addthefollowinglinesonTOPofyourPHPfile:
<?php
header("Expires:Mon,26Jul199705:00:00GMT");
header("Last-Modified:".gmdate("D,dMYH: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/INTERBASEGeneratedData");
//
//thenextlinesdemonstratethegenerationoftheExcelstream
//
xlsBOF(); //beginExcelstream
xlsWriteLabel(0,0,"Thisisalabel"); //writealabelinA1,usefordatestoo
xlsWriteNumber(0,1,9999); //writeanumberB1
xlsEOF();//closethestream
?>
----------------------------
ExcelFunctions
----------------------------
将下面的代码存为excel.php,然后在页面中包括进来
然后调用
1.CallxlsBOF()
2.将一些内容写入到xlswritenunber()或者xlswritelabel()中.
3.然后调用CallxlsEOF()
也可以用fwrite函数直接写到服务器上,而不是用echo仅仅在浏览器上显示。
<?php
//-----beginoffunctionlibrary-----
//Excelbeginoffileheader
functionxlsBOF(){
echopack("ssssss",0x809,0x8,0x0,0x10,0x0,0x0);
return;
}
//Excelendoffilefooter
functionxlsEOF(){
echopack("ss",0x0A,0x00);
return;
}
//FunctiontowriteaNumber(double)intoRow,Col
functionxlsWriteNumber($Row,$Col,$Value){
echopack("sssss",0x203,14,$Row,$Col,0x0);
echopack("d",$Value);
return;
}
//Functiontowritealabel(text)intoRow,Col
functionxlsWriteLabel($Row,$Col,$Value){
$L=strlen($Value);
echopack("ssssss",0x204,8+$L,$Row,$Col,0x0,$L);
echo$Value;
return;
}
//-----endoffunctionlibrary-----
?>
//
//TodisplaythecontentsdirectlyinaMIMEcompatiblebrowser
//addthefollowinglinesonTOPofyourPHPfile:
<?php
header("Expires:Mon,26Jul199705:00:00GMT");
header("Last-Modified:".gmdate("D,dMYH: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/INTERBASEGeneratedData");
//
//thenextlinesdemonstratethegenerationoftheExcelstream
//
xlsBOF(); //beginExcelstream
xlsWriteLabel(0,0,"Thisisalabel"); //writealabelinA1,usefordatestoo
xlsWriteNumber(0,1,9999); //writeanumberB1
xlsEOF();//closethestream
?>
相关文章
- 在线Excel存储方案
- excel vba 解密
- 用Excel处理笛卡尔积
- 2022年最新Python大数据之Excel基础
- mysql导入excel文件_将Excel数据导入MySQL「建议收藏」
- Python读取文件夹中的所有Excel文件名
- 图片链接如何在excel里转成图片_mdf文件怎么转成Excel
- Zebra BI 重大发布,与 Excel,PPT,Power BI 统一集成,一大壮举
- LyScript 计算片段Hash并写出Excel
- 高质量编码--Excel POI点高德地图展示
- java实现Excel导入导出功能
- Poi实现Excel导出工具类封装详解编程语言
- springMVC从上传的Excel文件中读取数据详解编程语言
- 数据库PHP操作MySQL数据库的精彩之旅(php读mysql)
- 安装Linux下的PHP环境(linux中安装php)
- 数据PHP简单操作实现MySQL数据输出(php输出mysql)
- 数据如何使用PHP在MySQL中添加数据(php添加mysql)
- 命令在PHP中执行Linux命令的方法(php执行linux)
- PHP让Redis让火焰升起(php开启redis)
- 数据PHP实现MySQL数据导出的实现方法(php导出mysql)
- MYSQL与EXCEL:实现数据管理的双重力量(mysql与excel)
- 深入探索:Linux 系统下 PHP 的适用与优势(Linux中php)
- PHP从Linux中读取文件的方法(php读取linux文件)
- 利用PHP实现MySQL数据库操作的简易指南(php实现mysql)
- PHP程序实现MSSQL数据库的连接(php程序连接mssql)
- PHP连接MSSQL:让你更快更好地实现数据互通(php接mssql)
- PHP与MSSQL融合产生的丰盛果实(php和mssql环境)
- Linux持续更新:升级PHP版本的魅力(linux升级php版本)
- Oracle PHP扩展拓展你的开发空间(oracle php扩展)
- 不重新编译PHP为php增加openssl模块的方法
- ThinkPHP使用PHPExcel实现Excel数据导入导出完整实例