How to export in phpexcel click Export to open the save dialog box and select save path to save

Source: Internet
Author: User
How to export in phpexcel click Export. The "Open save" dialog box is displayed. select the save path and save it. when you export in phpexcel, & nbsp; a file in excel can be generated directly upon a call and cannot be saved locally, how can I click Export to bring up the save dialog box and select the save path to save it? examples or ideas! & Nbsp; how to export in phpexcel click Export to bring up the open Save dialog box and select save path to save
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!

Export php in PhpExcel

Share:


------ 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.
------ Solution --------------------
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 ');
------ 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-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?
------ Solution --------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.