phpexcel

Getting cells by coordinate

醉酒当歌 提交于 2020-02-21 13:44:30
问题 foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { foreach ($worksheet->getRowIterator() as $row) { $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); // I wish echo $cellIterator->getCell("A3"); // row: $row, cell: A3 } } I'm looking for a similar method which named getCell above or well-writed PHPExcel documentation. Thanks. 回答1: If you have the $row information from RowIterator, you can just easily call: $rowIndex = $row->getRowIndex ();

Getting cells by coordinate

自古美人都是妖i 提交于 2020-02-21 13:43:46
问题 foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { foreach ($worksheet->getRowIterator() as $row) { $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); // I wish echo $cellIterator->getCell("A3"); // row: $row, cell: A3 } } I'm looking for a similar method which named getCell above or well-writed PHPExcel documentation. Thanks. 回答1: If you have the $row information from RowIterator, you can just easily call: $rowIndex = $row->getRowIndex ();

Extracting pictures/images within an Excel file (xls) using PHP

房东的猫 提交于 2020-02-21 12:33:23
问题 I have a spreadsheet that I would like to import using PHP. I can import the cell data using PHPExcel, but can't figure out how to use images from within the spreadsheet. Is there a way of doing this and then using the images within PHP to save to the server etc? Many thanks for the help! :) Update: @mark-baker - thank you so much for your help with this! I have used the code below on a test XLS file with one JPG: $objPHPExcel = PHPExcel_IOFactory::load("SH.xls"); foreach ($objPHPExcel-

Extracting pictures/images within an Excel file (xls) using PHP

只愿长相守 提交于 2020-02-21 12:32:21
问题 I have a spreadsheet that I would like to import using PHP. I can import the cell data using PHPExcel, but can't figure out how to use images from within the spreadsheet. Is there a way of doing this and then using the images within PHP to save to the server etc? Many thanks for the help! :) Update: @mark-baker - thank you so much for your help with this! I have used the code below on a test XLS file with one JPG: $objPHPExcel = PHPExcel_IOFactory::load("SH.xls"); foreach ($objPHPExcel-

ecshop 导出订单 导出excel订单

馋奶兔 提交于 2020-02-10 17:48:25
ecshop 导出订单 导出excel订单 很多时候,我们每月或者每年都需要做一个订单销售总结,这时要从ecshop订单管理里面拿订单详情,所以需要给ecshop订单管理加一个“导出订单”功能! 思路分析:ecshop后台的“订单管理”里面“打印订单”就是我们要的内容,只需要把内容用PHPExcel导出到一个excel表里面即可。 最终效果:所有信息版,为了能看全所有信息,我把列缩小了 1,admin\templates\order_list.htm 加入“导出订单”按钮 <input name="confirm" type="submit" id="btnSubmit" value="{$lang.op_confirm}" class="button" disabled="true" onclick="this.form.target = '_self'" /> <input name="invalid" type="submit" id="btnSubmit1" value="{$lang.op_invalid}" class="button" disabled="true" onclick="this.form.target = '_self'" /> <input name="cancel" type="submit" id="btnSubmit2" value="{

THinkPHP3.2 使用 PHPExcel 生成 excel 文件

感情迁移 提交于 2020-02-05 15:23:22
1.PHPExcel是什么 PHPExcel 是一个采用 PHP 生成/读取 excel 文件的类库,其中包含了各种 excel 的操作,用途非常广泛,不过根据官方的公告,其在 2019 年已经停止更新,但是之前已经实现的功能已经足够我们日常使用了。 2.下载 下载地址: https://github.com/PHPOffice/PHPExcel/releases ,选择最新版本下载即可。 目录结构如下: 3.放入vendor库 为了在 THinkPHP3.2 中使用,只需要将下载下来的 Classes 中的文件夹,放置于 ThinkPHP/Library/Vendor/PHPExcel/ 目录下即可。 Classes 文件夹中的目录: THinkPHP 目录: 4.加载 采用 TP3.2 自带的加载方法对类库进行加载即可: vendor('PHPExcel.PHPExcel'); 加载完成后,通过示例代码即可进行导出: /** Error reporting */ error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); if (PHP_SAPI == 'cli') die('This example should only be run

数组转xls格式的excel文件&数据转csv格式的excle

拟墨画扇 提交于 2020-02-01 08:24:26
/** * 数组转xls格式的excel文件 * @param array $data 需要生成excel文件的数组 * @param string $filename 生成的excel文件名 * 示例数据: $data = array( array(NULL, 2010, 2011, 2012), array('Q1', 12, 15, 21), array('Q2', 56, 73, 86), array('Q3', 52, 61, 69), array('Q4', 30, 32, 0), ); */ function create_xls($data,$filename='simple.xls'){ ini_set('max_execution_time', '0'); Vendor('PHPExcel.PHPExcel'); $filename=str_replace('.xls', '', $filename).'.xls'; $phpexcel = new PHPExcel(); $phpexcel->getProperties() ->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") -

Download with php with headers do not work on IE8

南楼画角 提交于 2020-02-01 05:37:13
问题 I am trying to download a excel file generated on the fly with php headers: $filename = "assets.xls"; header('Content-Type: application/vnd.ms-excel'); header("Content-Disposition: attachment;filename=$filename"); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); But this does not work on IE8 (but on some other pc with IE8 works???!!). IE8 tries to download the export.php file instead of assets.xls. Any

Phpspreadsheet - Time cell retrieved as float

前提是你 提交于 2020-01-30 09:50:29
问题 I have an excel file which has a time input. Mar 01, 2018 | Thursday | 8:00 AM | 5:00 PM Mar 02, 2018 | Friday | 8:00 AM | 5:00 PM But when my code tries to read those cells, the output becomes a float (for example 8:00 AM becomes 0.33333333333333 ). This is my code $date = $sheet->getCell("A".$row)->getValue(); $time_in = $sheet->getCell("C".$row)->getValue(); $time_out = $sheet->getCell("D".$row)->getValue(); echo "date: ".$date. //Mar 01, 2018 " time_in: ".$time_in. //becomes 0

phpexcel how get cell format

[亡魂溺海] 提交于 2020-01-30 08:43:11
问题 How I can get cell format? I Try $E->getActiveSheet()->getCellByColumnAndRow(0, 24)->getCalculatedValue() but it rerurns '6', I need '6 бухта' (sorry for russian letters) 回答1: $E->getActiveSheet()->getCellByColumnAndRow(0, 24) ->getFormattedValue() 回答2: you can get the cell format by code, var_dump($objPHPExcel->getActiveSheet()->getCell('D3')->getStyle()->getNumberFormat()->getFormatCode()); and output will be like: string(8) "mm-dd-yy" 来源: https://stackoverflow.com/questions/15722801