当我尝试导出到Excel时,电子表格的最后一部分丢失了。在网站上我可以获得5003条记录,但是当我尝试导出到excel时,我只获得3700行(记录)。所以最后一部分没有显示出来。我使用以下标题将页面下载为excel并通过ajax调用页面。
header("Pragma: public");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Cache-Control: maxage=3600"); //Adjust maxage appropriately
header('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename=\"".$title.".xls\"");
header("Content-transfer-encoding: binary");
编辑: 即时通讯使用以下代码
$sql = "select * from transactions";
$rs = $cn->Execute($sql);
while(!$rs->EOF){
echo "<tr><td>".$rs->fields['transid'];."</td></tr>";
//other fields here
$rs->MoveNext();
}
//even if i put something here it will not be displayed.
echo "<tr><td>something here</td></tr>";
这应该输出一个excel文件,显示总交易量为5003的所有交易