phpexcel

PHPExcel - memory leak when I go through all rows

痞子三分冷 提交于 2019-12-25 05:29:11
问题 I'm using PHPExcel library for reading xls and xlsx files. Below is a sample function for demonstrating problem that I have: public function memoryAction() { $filename = "example.xlsx"; echo "<br>Script started<br>"; echo memory_get_usage(true); $inputFileType = PHPExcel_IOFactory::identify($filename); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setReadDataOnly(true); $objReader->setLoadSheetsOnly(array('OTMS','Printing')); $excelReader = $objReader->load(

How to check the date type in array in PHP

拜拜、爱过 提交于 2019-12-25 04:55:16
问题 I'm using PHPExcel to read the data, and then validating the data. Problem I'm getting is all the data is validating except I don't know how to check the array if it has a date or not. Problem is not a format, problem is I'm unable to find a way to check whether it is a date or another string or integer. These are one of my value in a date cell in Excel file. i.e ; 1/2/15 17:24 1/7/15 12:00 1/9/15 11:57 回答1: For each cell you can check if this is a date : if(PHPExcel_Shared_Date::isDateTime(

Using phpexcel to export MySql to excel

只愿长相守 提交于 2019-12-25 04:42:11
问题 Hi everyone I have created a program to export MySQL data to excel but at some point I am getting the error the time I am trying to open the excel file. The error: The file you are trying to open is in a different format,than specified by the file extension.Verify that the file is not corrupt and is from the trusted source before opening the file.Do you want to open the file now? When I click yes i get the some funny characters on that excel file. Here is my code: include 'setup.php';

How to get XLS file format value using PHPExcel

不羁岁月 提交于 2019-12-25 04:37:16
问题 I have XLS cells deference number formatted. this how look like my cells E8: Date formatted cell E9: Number formatted cell E10: General formatted cell E11: Percentage formatted cell E12: Fraction formatted cell I want to read these above cells data without any changes(Friday, May 10, 2013 , 41404.00, drfsdf, 1/2) i use below method for that but i didn't success every bellow method return for text value of the cells $objReader = new PHPExcel_Reader_Excel5(); $objReader->setReadDataOnly(true);

Error While loading excel sheet Using phpexcel

蓝咒 提交于 2019-12-25 04:27:00
问题 I am trying to load excel sheet (generated by other application) using phpexcel library, with following code: $objReader = new PHPExcel_Reader_Excel2007(); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load('callsheet.xlsx'); $objPHPExcel->setActiveSheetIndex(0); $dataArray = $objPHPExcel->getActiveSheet()->toArray(null, true,true,true); var_dump($dataArray); But I got this error. Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'You tried to set a sheet

PHP Date : get date different in years

断了今生、忘了曾经 提交于 2019-12-25 03:53:08
问题 this is my code: date_default_timezone_set('Asia/Kuala_Lumpur'); $date_join = $row['date_joined']; =produce 2012-09-03 $today = date("Y-m-d"); = produce 2014-08-29 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('H'.$a, **$xxx**); how can i get date durations ($today - $date_join) in years like : Date of services : 1.5 years 回答1: You can use PHP strtotime() function . Try like this.. $join_date = '2012-09-03'; //join date $today = date("Y-m-d"); //current date $date_join = strtotime($join

PHP Date : get date different in years

亡梦爱人 提交于 2019-12-25 03:53:08
问题 this is my code: date_default_timezone_set('Asia/Kuala_Lumpur'); $date_join = $row['date_joined']; =produce 2012-09-03 $today = date("Y-m-d"); = produce 2014-08-29 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('H'.$a, **$xxx**); how can i get date durations ($today - $date_join) in years like : Date of services : 1.5 years 回答1: You can use PHP strtotime() function . Try like this.. $join_date = '2012-09-03'; //join date $today = date("Y-m-d"); //current date $date_join = strtotime($join

PHPExcel Force Download Issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:37:05
问题 I know this might have been asked in several pieces, but I could not find an exact answer to the issue. I am using PHPExcel to generate an Excel file (obviously), and the code works to generate the file, but not when I include the code for Force Download, it corrupts the file. My latest version of the script looks like this: function make_xls_spreadsheet(){ /** Error reporting */ error_reporting(E_ALL); /* Set the save path */ define('XLSX_SAVE_PATH', 'tmp/'); /** Include path **/ set_include

export mysql data from two tables to excel using php and phpexcel

陌路散爱 提交于 2019-12-25 03:32:39
问题 I am trying to get data from to mysql table and output to a single excel file. The data needs to come side-by-side. But the output excel file contains only special characters instead of mysql data. Please point me to the right direction. Here is my code: <?php // connection with the database $dbhost = "localhost"; $dbuser = "root"; $dbpass = "redhat"; $dbname = "was"; mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname); // require the PHPExcel file require 'phpexcel/Classes

PhpExcel Bar Chart

此生再无相见时 提交于 2019-12-25 02:59:31
问题 I want to change the color of each bar in my bar chart , the chart is like: There are four products product 1 product 2 product 3 product 4 There are two bars for each product, one is total value and one is overall value. Total value should have Black color. overall value should according to its product. Right now its coming only two colors Blue for total value red for overall value. So please help me for creating such bar chart who has different colors for different product. Thanks in