phpexcel

PhpExcel Save file to a folder

可紊 提交于 2019-12-25 02:45:01
问题 I want to save the generated file to a folder located in the server, I tried the following code : //save it to Excel5 format (excel 2003 .XLS file), change this to 'Excel2007' (and adjust the filename extension, also the header mime type) //if you want to save it as .XLSX Excel 2007 format $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); //force user to download the Excel file without writing it to server's HD $objWriter->save('‪C:\xampp\htdocs\timesheet\files\trials.xls

PHPExcel - Reading Date values

与世无争的帅哥 提交于 2019-12-25 01:45:29
问题 I am using PHPExcel library to read spread sheet data. This library is giving me trouble reading the 'DATE' values. Question: How to instruct the PHPExcel to read the 'DATE' values properly even if 'setReadDataOnly' is set as 'false'? Description: PHPExcel version: 2.1, Environment: Ubuntu 12 Here is the code block: $objReader = \PhpExcel\PHPExcel_IOFactory::createReaderForFile($spreadSheetFullFilePathString); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load(

php 利用phpexcel 导出数据

余生颓废 提交于 2019-12-25 00:31:48
新的,也不废话 如果有特殊的字符串 = 麻烦  str_replace(array('='),'',$val['roleName']); private function _export_data($data = array()) { error_reporting(E_ALL); //开启错误 set_time_limit(0); //脚本不超时 date_default_timezone_set('Europe/London'); //设置时间 /** Include path **/ set_include_path(FCPATH.APPPATH.'/libraries/Classes/');//设置环境变量 // Create new PHPExcel object Include 'PHPExcel.php'; $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") ->setSubject("Office 2007

Error with the formulas

你。 提交于 2019-12-24 21:41:07
问题 I want to set formula to cell but im getting error on my way. Theres a code: $objReader = PHPExcel_IOFactory::load($path.$filename); $objReader->setActiveSheetIndex(0); $objReader->getActiveSheet() ->setCellValue('C2','=VLOOKUP(A9;A3:B32;2)'); $objWriter = PHPExcel_IOFactory::createWriter($objReader, 'Excel5'); $objWriter->save($path.'plik.xls'); Formula is copied from normal sheet so she's wright. Im getting this msg: feuil1!C2 -> Formula Error: An unexpected error occured . 回答1: Unless you

PHPExcel Class 'PHPExcel_Worksheet' not found

 ̄綄美尐妖づ 提交于 2019-12-24 13:30:31
问题 I got the following error when importing PHPExcel into my framework: Fatal error: Class 'PHPExcel_Worksheet' not found in /var/www/library/phpexcel.class.php on line 109 I am autoloading my classes including PHPExcel but it looks like PHPExcel uses spl_autoload_register to register any existing autoloader functions with SPL. I also tried echoing the files as they were being loaded and got /var/www/library/PHPExcel/Shared/ZipStreamWrapper.php /var/www/library/PHPExcel/Shared/String.php Fatal

PHPExcel: How to save the loaded file after changes has made on it?

三世轮回 提交于 2019-12-24 12:41:23
问题 I have made some changes on a file using PHP and realized nothing was changes after running the code (with no any errors). I understood that I have to save the file right after I change stuff in it. When using the 'save' function, I get: ( ! ) Fatal error: Call to undefined method PHPExcel_Worksheet::save() in C:\wamp\www\PHPExcel\excel_fun.php on line 32 this is my function and the way I am calling it: function save_file(){ global $objPHPExcel; $objPHPExcel->getActiveSheet()->save('keywords

PHPExcel setCellValueByColumnAndRow() to datetime cell format

烈酒焚心 提交于 2019-12-24 09:36:43
问题 Hi can somebody tell me how to set phpexcel cell format to datetime if I have datatime in php variable? I use it this way but it is only string: $list->setCellValueByColumnAndRow( ++$column, $row, $survey->task->closed->format(DateTimeUtils::DATE_FORMAT_NO_SPACES) ); EDIT: Now I have this code: $list->setCellValueByColumnAndRow( ++$column, $row, \PHPExcel_Shared_Date::PHPToExcel( $survey->task->closed ) ) ->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_DATE

Export SQL data from database to Excel using PHPExcel

六眼飞鱼酱① 提交于 2019-12-24 08:47:06
问题 I am trying to export data from my database to Excel using PHPExcel. I used the code from this question. Edited mysql to mysqli and changed the extension to xlsx format. But when I want to open the file I get the following error (I translated it into English so sorry for my bad English if it isn't right) The file rapportage 29-05-2017.xlsx can't be opened because the file format or file extension is not valid. Check if the file isn't damaged and if the file extension matches with the format

PHPExcel output to browser doesn't work in IE

不问归期 提交于 2019-12-24 08:19:01
问题 I have a PHP script that uses PHPExcel to open a template, insert values from a database query then return the result to the browser. It works perfectly in Firefox, but in Internet Explorer (8), when it attempts to open the file, it breaks with: Internet Explorer cannot download generate.php from my.domain. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. The code that I'm using ( generate.php ) is

PHPExcel removes chart style when template is loaded

南笙酒味 提交于 2019-12-24 07:29:35
问题 I am using PHPExcel to read and write values to Excel. I have a template that has a graph and a style on it. Here's the issue: After I appended some value on the Excel sheet, the style of the chart has been remove and it shows the default style. I am using this code to read: $objReader = PHPExcel_IOFactory::createReader('Excel2007'); // Tell the reader to include charts when it loads a file $objReader->setIncludeCharts(TRUE); // Load the file $objPHPExcel = $objReader->load("rcca.xlsx"); And