Phpexcel Export How to implement click Export after pop-up open Save Dialog Select Save Path Save

Source: Internet
Author: User
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

  • 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.