How to export in phpexcel click Export to open the save dialog box and select the save path to save PhpExcel export php
When you export data using phpexcel, you can directly generate an excel file and cannot save it locally. how can you click Export to bring up the save dialog box and select the save path to save it, practical examples or ideas!
Reply to discussion (solution)
The file is generated on the server. If JavaScript points to the generated excel file that cannot be opened by the browser, will the file be downloaded?
I have never tried it.
Save ()
Changed:
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, 26 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-> setActiveSheetIndex (0 );
// Redirect output to a clients web browser (Excel5) notification download
$ Fn = "gxtj-policyear-policjd.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;
Statement: This article is Liu Xing (http://deepfuture.iteye.com/) original, if reprint please indicate the source
Can this problem be solved?
Save ()
Changed:
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, 26 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 specifics? I used zendframework to pull data from the database in the background Action and put it in the excl document. the code was put without any response.
Save ()
Changed:
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, 26 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 specifics? I used zendframework to pull data from the database in the background Action and put it in the excl document. the code was put without any response.
Not put it on .. Do you not need to change the variable name? Is your PHPEXCEL class $ objWriter instantiated? Change to your own.
Ps: Open the error prompt and check what the error is. if there is no response, it may be wrong.
Http://www.cnblogs.com/dahuzizyd/archive/2012/07/06/2579738.html