Phpexcel Export How to implement click Export after pop-up open Save Dialog Select Save Path Save
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! Phpexcel Export PHP
Share to:
------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.
------Solution--------------------
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 ');
------Solution--------------------
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->setactivesheetindex (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
Disclaimer: This article is Liu Xing (http://deepfuture.iteye.com/) original, if reproduced please indicate the source
Can you solve it?
------Solution--------------------