phpexcel

Phpexcel display sheet(2) in html

雨燕双飞 提交于 2019-12-11 03:07:16
问题 I have to display an excel workbook in html form because some will view the page with Macbooks and for sure not everybody has excel installed. The workbook has five sheets which have different number of columns and the column widths are different, so they cannot be put in one sheet. I'm using wamp server 2.4 with phpexcel 1.8, php 5.4.16, apache 2.4.4 under windows XP. I can get the different sheets active (show up first) by getActiveSheet(). But when I tried to display them in html, only the

Explicitly set a cell’s datatype as text for number values

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:49:00
问题 I want to explicitly set a cell’s datatype as a text for number values. I am fetching data from my MySQL database and exporting to excel file using PHPExcel Library. I have large about 20 digit long numbers which I want to export to excel cell(each cell of the entire column will have different numbers). I have found that you can do this by code mentioned PHPExcel Documentation 4.6.7. $i=0; foreach($dd as $d) { $objPHPExcel ->setActiveSheetIndex(0) ->getcell('A'.$i) ->setValueExplicit($d[

Generate Excel file, but do not save to the server

瘦欲@ 提交于 2019-12-11 02:25:32
问题 I have an Excel file file.xlsx . I open this file with PHPExcel and insert my datas: $excel2->getActiveSheet() ->setCellValue('A2', $rowCardCode['podpodrazd'].", ".$rowCardCode['schet']) ->setCellValue('C2', $rowCardCode['tovar_name']) ->setCellValue('C3', $rowCardCode['edinica_izmer']); After, I can save generated file with new name ( temp/New_file.xlsx ). $objWriter = PHPExcel_IOFactory::createWriter($excel2, 'Excel2007'); $objWriter->save('files/temp_file/card/card_'.time().'.xlsx'); I don

PHPExcel String to Time

若如初见. 提交于 2019-12-11 02:11:33
问题 I have created an Excel spreadsheet. In the second column I have values like 0:11:23 and 2:03:33 , several thousand rows worth. Using PHP I set the format to be: $sheet->getStyle($colRange)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4); But the cells are all still just strings. If you edit a cell from 0:11:22 to something else like 0:11:33 then the cell WILL get converted into a time. At the top it goes from 0:11:22 to 0:11:33 AM this auto addition of AM is

PHPExcel date field does not match source spreadsheet

可紊 提交于 2019-12-11 01:29:45
问题 This is what is in my spreadsheet: 12/04/2011 8:56:17 p.m. (xls dateserial = 40645.87242) this is my code I'm using to extract the date and convert to date string in PHP: $txn_date_xls = $sheet->getCell("H$row")->getValue(); echo "Txn Date (original): $txn_date_xls<br />"; $txn_date = PHPExcel_Shared_Date::ExcelToPHP($txn_date_xls); echo "Txn Date: ".date('Y-m-d H:i:s', $txn_date)."<br />"; This is the output from my script: Txn Date (original): 40644.55783637732 Txn Date: 2011-04-11 13:23:17

Help with PHPExcel Library and mySQL data from a table

五迷三道 提交于 2019-12-11 00:37:00
问题 I have this script $query = "SELECT id,last_name,first_name FROM users WHERE tmima_id='6'"; $result = @mysql_query($query); while($row = mysql_fetch_array($result)) { $i = 3; $emp_id = $row['id']; $cell = 'A'.$i; $objPHPExcel->setActiveSheetIndex(0) ->setCellValue($cell, $row['last_name']. $row['first_name']); $i++; } But in the .xls file it prints only one user. Why id doesnt print all of the users ? W Thanks in advance. I make the change you said with $sheet $query = "SELECT id,last_name

PHPExcel - chart rendering and load excel giving error

删除回忆录丶 提交于 2019-12-10 21:44:35
问题 require_once('PHPExcel-1.7.7/Classes/PHPExcel.php'); $inputFileName = 'RN Tracker.xlsx'; $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); if i try following $objReader->setIncludeCharts(TRUE); during load i get following error message: Warning: PHPExcel_Reader_Excel2007::load(): Node no longer exists in /users/pravkum4/html/tracker/PHPExcel-1.7.7/Classes/PHPExcel/Reader/Excel2007.php on line 1518 Notice: Trying to

Read the list of options in a drop-down list - Phpexcel

徘徊边缘 提交于 2019-12-10 21:09:58
问题 I want to read the list of options that are given within a drop-down in an excel sheet. For example: - There is a cell(86,G) that has Not Attempted as an option but it is a drop down list. So no matter what the user selects i want to read the last option from the drop-down. How to achieve this? Thanks 回答1: Follow the below Steps to read drop down in PHPExcel Step 1: Store the drop down data in separate sheet Step 2: Create Drop down in separate sheet Refer the below code. $newSheet=

Excel sheet corrupted after conditional formatting

泄露秘密 提交于 2019-12-10 18:43:56
问题 I am generating an excel sheet with phpexcel, when using conditional formatting with the condition being (search for a text or part of it), i get a validation error when trying to open the generated sheet. Works perfectly with numbers, Less so WITH TEXTS. Here is my code : //conditional formatting $objConditional1 = new PHPExcel_Style_Conditional(); $objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR

PHP Excel style formatting using col & row index

若如初见. 提交于 2019-12-10 18:11:50
问题 we can apply a style on a range of cells like this $objPHPExcel->getActiveSheet()->duplicateStyleArray($array_of_style,"A1:D1"); But I want to apply same style to a range of cells on their column and row reference like (3,4,7,7); Please help me on this. I am not a newbie on phpexcel but could not find any method to apply a style on range given in col & row index. 回答1: function duplicateStyleArrayByColumnAndRow( PHPExcel $objPHPExcel, $styleArray = array(), $fromRow = 1, $fromCol = 0, $toRow =