Phpexcel Exporting PHP
When using Phpexcel export to find a call directly generated an Excel file, can not be saved to the local, how to implement click Export, Pop-up Save dialog box and choose Save Path to save it, find an example or ideas!
Reply to discussion (solution)
The build is generated on the server bar with JS pointing to the generated Excel file browser cannot open it will prompt to download it?
Pure speculation has not been tried.
Last save phase of the->save ()
Switch
Header ("Content-type:application/force-download");
Header ("Content-type:application/octet-stream");
Header ("Content-type:application/download");
Header (' Content-disposition:inline;filename= '. $FileName. ' ');
Header ("Content-transfer-encoding:binary");
Header ("Expires:mon, Jul 1997 05:00:00 GMT");
Header ("last-modified:".) Gmdate ("D, D M Y h:i:s"). "GMT");
Header ("Cache-control:must-revalidate, Post-check=0, pre-check=0");
Header ("Pragma:no-cache");
$objWriter->save (' php://output ');
//sheet name
$objPHPExcel->getactivesheet ()->settitle (' Performance appraisal statistics ');
//Set Active sheet Index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setactives Heetindex (0);
//Redirect output to a clients web browser (EXCEL5) notification download
$fn = "gxtj-$year-$jd. xls";
Header (' Content-type:application/vnd.ms-excel; Charset=utf-8 ');
Header ("Content-disposition:attachment;filename= $fn");
Header (' cache-control:max-age=0 ');
$objWriter = Phpexcel_iofactory::createwriter ($objPHPExcel, ' Excel5 ');
$objWriter->save (' php://output ');
Exit;
Declaration: This article is Liu Xing (http://deepfuture.iteye.com/) original, if reproduced please indicate the source
can solve it
should read:
header ("Content-type:application/force-download");
Header ("Content-type:application/octet-stream");
Header ("Content-type:application/download");
Header (' content-disposition:inline;filename= '. $FileName. ');
Header ("Content-transfer-encoding:binary");
Header ("Expires:mon, 1997 05:00:00 GMT");
Header ("last-modified:".) Gmdate ("D, D M Y h:i:s"). "GMT");
Header ("Cache-control:must-revalidate, Post-check=0, pre-check=0");
Header ("Pragma:no-cache");
$objWriter->save (' php://output ');
can I ask the specific point, I use Zendframework is in the background action in the data from the database into the excl document, the code put up, no response
Last save phase of the->save ()
Switch
Header ("Content-type:application/force-download");
Header ("Content-type:application/octet-stream");
Header ("Content-type:application/download");
Header (' Content-disposition:inline;filename= '. $FileName. ' ');
Header ("Content-transfer-encoding:binary");
Header ("Expires:mon, Jul 1997 05:00:00 GMT");
Header ("last-modified:".) Gmdate ("D, D M Y h:i:s"). "GMT");
Header ("Cache-control:must-revalidate, Post-check=0, pre-check=0");
Header ("Pragma:no-cache");
$objWriter->save (' php://output ');
Can you tell me the details, I use Zendframework is in the background action in the data from the database into the excl document, the code put up, no response
Not put it up. Variable name you don't have to change it? Is your instantiation of the Phpexcel class $objwriter? Instead of your own.
PS: Open the error prompt to see what the error is, no response may be wrong
Http://www.cnblogs.com/dahuzizyd/archive/2012/07/06/2579738.html