How to select a path when saving in PHPExcel

Source: Internet
Author: User
How do I select a path when saving in PHPExcel? How can I select the storage path for exporting Excel using PHPExcel ?? PHPcodeset_include_path (get_include_path (). PATH_SEPARATOR.LIB_DIR.DIRECTORY_SEPARAT how to select a path when saving in PHPExcel?
How can I select the storage path for exporting Excel using PHPExcel ??
PHP code
  Set_include_path (get_include_path (). PATH_SEPARATOR. LIB_DIR.DIRECTORY_SEPARATOR. "PHPExcel ". DIRECTORY_SEPARATOR. "Classes"); include 'phpexcel. php'; include 'phpexcel/IOFactory. php '; $ objPHPExcel = new PHPExcel (); $ objPHPExcel-> getProperties ()-> setCreator ("Maarten Balliauw"); $ objPHPExcel-> getProperties () -> setLastModifiedBy ("Maarten Balliauw"); $ objPHPExcel-> getProperties ()-> setTitle ("Office 2007 XLSX T Est Document "); $ objPHPExcel-> getProperties ()-> setSubject (" Office 2007 XLSX Test Document "); $ objPHPExcel-> getProperties () -> setDescription ("Test document for Office 2007 XLSX, generated using PHP classes. "); $ objPHPExcel-> getProperties ()-> setKeywords (" office 2007 openxml php "); $ objPHPExcel-> getProperties ()-> setCategory (" Test result file "); $ objPHPExcel-> setActiveSheetIndex (0); $ objPHPExcel-> getActiveSh Eet ()-> setCellValue ('A1', 'Hello'); $ objPHPExcel-> getActiveSheet ()-> setCellValue ('B2', 'World! '); $ ObjPHPExcel-> getActiveSheet ()-> setCellValue ('C1', 'Hello'); $ objPHPExcel-> getActiveSheet ()-> setCellValue ('D2 ', 'world! '); $ ObjPHPExcel-> getActiveSheet ()-> setTitle ('simple'); $ objPHPExcel-> setActiveSheetIndex (0); $ objWriter = PHPExcel_IOFactory: createWriter ($ objPHPExcel, 'excel2007 '); // save the following two sentences to the current directory: $ outputFileName = "output.xlsx"; $ objWriter-> save ($ outputFileName ); // if I want to prompt the user to select the path before saving the file, I will use the following method (from the Internet), but he will output it directly to the browser, you are not prompted to save the header ("Content-Type: application/force-download"); header ('content-Disposition: inline; filename = "'. $ outputFileName. '"'); 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 --------------------
Help!
------ Solution --------------------
PHP code
Header ("Pragma: public"); header ("Expires: 0"); header ("Cache-Control: must-revalidate, post-check = 0, pre-check = 0 "); header (" Content-Type: application/force-download "); header (" Content-Type: application/download "); header ("Content-Disposition: attachment; filename = $ outputFileName"); header ("Content-Transfer-Encoding: binary ");
------ Solution --------------------
This sentence
Header ('content-Disposition: inline; filename = "'. $ outputFileName .'"');
Change
Header ("Content-Disposition: attachment; filename = $ outputFileName ");
------ Solution --------------------
No problem. you can use the original code.

An error occurred in the second line.
Set_include_path (get_include_path (). PATH_SEPARATOR. LIB_DIR.DIRECTORY_SEPARATOR. "PHPExcel". DIRECTORY_SEPARATOR. "Classes ");
Change it to the following.
// Set_include_path (get_include_path (). PATH_SEPARATOR. LIB_DIR.DIRECTORY_SEPARATOR. "PHPExcel". DIRECTORY_SEPARATOR. "Classes ");

------ Solution --------------------
Top
------ Solution --------------------
Help

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.