我已经成功创建并保存了一个 Excel 文件:
// Rename the file
$fileName = URL . "MODEL/case" . $caseNO . ".xlsx";
// Write the file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $fileType);
$objWriter->save($fileName);
我现在希望 PHPExcel 自动运行 Excel,打开创建的文件并将其最大化。
是否可以?即使 Excel 已经在运行,这也能工作吗?
感谢您的帮助,
Donato
根据我上面的评论,你只能强制有一个下载选项。为此,您可以通过这种方式设置标题 -
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Disposition: attachment;filename=\"filename.xlsx\"");
header("Cache-Control: max-age=0");
参考 -PHP Excel 阅读器 https://stackoverflow.com/questions/9856518/php-excel-header
如需更多选项,您还可以查看备忘单 -备忘单 http://clock.co.uk/tech-blogs/phpexcel-cheatsheet
虽然在这里阅读的最佳方式 -Codeplex http://phpexcel.codeplex.com/documentation
EDIT
做这样的事情 -
$excel = new PHPExcel();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="your_name.xls"');
header('Cache-Control: max-age=0');
// Do your stuff here
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
// This line will force the file to download
$writer->save('php://output');
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)