Created
April 10, 2014 04:50
-
-
Save anonymous/10343416 to your computer and use it in GitHub Desktop.
function to get the value of the merged cell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## usage: | |
## PHP Excel | |
## $objPHPExcel->setActiveSheetIndex(1); | |
## $objSheet = $objPHPExcel->getActiveSheet(); | |
## | |
function mergedcellvalue($objSheet, $cell) | |
{ | |
foreach ($objSheet->getMergeCells() as $key => $cellarea) { | |
if($objSheet->getCell($cell)->isInRange($cellarea)){ | |
return $objSheet->getCell(array_shift(explode(":", $cellarea)))->getValue(); | |
} | |
} | |
return $objSheet->getCell($cell)->getValue(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment