Skip to content

Instantly share code, notes, and snippets.

Created April 10, 2014 04:50
Show Gist options
  • Save anonymous/10343416 to your computer and use it in GitHub Desktop.
Save anonymous/10343416 to your computer and use it in GitHub Desktop.
function to get the value of the merged cell
## 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