求用PHP将MySQL数据表转换为Excel表的方法! http://pear.php.net/package/Spreadsheet_Excel_Writer自己写脚本哦还有phpMyAdmin2.6.x也能直接导出数据到Excel的很方便 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 phpMyAdmin能导出MS Excel 的 CSV 格式 谢谢!phpMyAdmin确实可以。不过我想实现的是把符合条件的搜索结果导出来,而不是导出整个表。搜索的功能我已经实现了,就差导出的功能了。那个Spreadsheet Excel Writer不知道怎么用,能不能解释一下? phpMyAdmin也可以按搜索条件导出,我看到了。可是到phpMyAdmin里面操作还是不太方便。 直接将程序产生的html表格写到后缀为xls的文件里就可以了 下载解压以后应该放到哪个目录?我放在网页目录下运行writer.php出错,我从来没有用过pear,不知道应该如何配置? 我写了一个类 class Cexcel { var $fileName; function Cexcel($file) { if($file!='') { $this->fileName=$file; } } function Downxls() { header("Content-type: application/vnd.ms-excel"); header("Content-Length: ".filesize("./".$this->fileName."")); header("Content-Disposition: attachment; filename=./".$this->fileName.""); if(file_exists("./".$this->fileName."")) readfile("./".$this->fileName.""); exit(0); } function xlsBOF() { return pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); } function xlsEOF() { return pack("ss", 0x0A, 0x00); } function xlsWriteNumber($Row, $Col, $Value) { $result=pack("sssss", 0x203, 14, $Row, $Col, 0x0); $result.=pack("d", $Value); return $result; } function xlsWriteLabel($Row, $Col, $Value ) { $L = strlen($Value); $result=pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); $result.=$Value; return $result; } } 调用方法,就按下面顺序可以了了xlsBOF() xlsWriteLabelxlsWriteNumberxlsBOF() Downxls() PHP页面中打开文件的路径 跳出下载提示框 请教一个WAMP5服务器绑定域名的问题 PHP分页代码 有没有把 GD函数 封装好的图像类??? 求一个网上调查系统源码。。重分感谢!! PHP 5.0.3RC1 released! 急,请帮我这段C程序转成PHP程序 学习模板好长时间了,还是好模糊,能再给点帮助吗? mysql问题 关于php的两个简单问题! 地址栏里网址前边会有一个小图片,请问怎么添加这个图片 研究一个问题,顶者有分(100分,不够另开帖散分):PHP5 JAVA整合的配置方法.
class Cexcel
{
var $fileName;
function Cexcel($file)
{
if($file!='')
{
$this->fileName=$file;
}
}
function Downxls() {
header("Content-type: application/vnd.ms-excel");
header("Content-Length: ".filesize("./".$this->fileName.""));
header("Content-Disposition: attachment; filename=./".$this->fileName."");
if(file_exists("./".$this->fileName.""))
readfile("./".$this->fileName."");
exit(0);
}
function xlsBOF() {
return pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
}
function xlsEOF() {
return pack("ss", 0x0A, 0x00);
}
function xlsWriteNumber($Row, $Col, $Value) {
$result=pack("sssss", 0x203, 14, $Row, $Col, 0x0);
$result.=pack("d", $Value);
return $result;
}
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
$result=pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
$result.=$Value;
return $result;
}
}
xlsBOF()
xlsWriteLabel
xlsWriteNumber
xlsBOF()
Downxls()