I have function:
function funct($xls){
include_once '../system/PHPExcel/Classes/PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load($xls);
$objPHPExcel->setActiveSheetIndex(9);
$aSheet = $objPHPExcel->getActiveSheet();
$array = array();
foreach($aSheet->getRowIterator() as $row){
$cellIterator = $row->getCellIterator();
//this array will contain arrays with cells values
$item = array();
foreach($cellIterator as $key => $cell){
//skip adding tables which we don't need
if($key == "A" || $key == "E" || $key == "F" || $key == "G" || $key == 'H') continue;
array_push($item, $cell->getCalculatedValue());
}
array_push($array, $item);
}
return $array;
}
How can I use the following code?
$this->mergedCellsRange = $this->activeSheet->getMergeCells();
foreach($this->mergedCellsRange as $currMergedRange) {
if($cell->isInRange($currMergedRange)) {
$currMergedCellsArray = PHPExcel_Cell::splitRange($currMergedRange);
$cell = $this->activeSheet->getCell($currMergedCellsArray[0][0]);
break;
}
}
For work with merged cells inside my code. Currently my function add value only for first cell, and all an others is empty.
Thank you.
Found an answer for my issue: