我从http://network.convergenceservices.in/forum/5-components/2191-export-excel-a-new-way.html
获取以下代码段function xlsBOF() {
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
return;
}
function xlsEOF() {
echo pack("ss", 0x0A, 0x00);
return;
}
function xlsWriteNumber($Row, $Col, $Value) {
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
echo pack("d", $Value);
return;
}
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
echo $Value;
return;
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=vandetailslist.xls ");
header("Content-Transfer-Encoding: binary");
xlsBOF();
xlsWriteLabel(0,0,"Column 1");
xlsWriteLabel(0,1,"Column 2");
xlsWriteLabel(0,2,"Column 3");
xlsWriteLabel(0,3,"Column 4");
$xlsRow = 1;
foreach($somearray as $value)
{
xlsWriteNumber($xlsRow,0,"{Column Value 1}");
xlsWriteLabel($xlsRow,1,"{Column Value 2}");
xlsWriteLabel($xlsRow,2,"{Column Value 3}");
xlsWriteLabel($xlsRow,3,"{Column Value 4}");
$xlsRow++;
}
xlsEOF();
exit;
问题是我想在每张纸上只添加10条记录,如果数据更多,我想添加一张新纸张并开始在那里添加行。我无法找到添加新工作表的方法。任何帮助将不胜感激。