public function mergeCells($pRange = 'A1:A1')
    {
        // Uppercase coordinate
        $pRange = strtoupper($pRange);

        if (strpos($pRange,':') !== false) {
            $this->_mergeCells[$pRange] = $pRange;

            // make sure cells are created

            // get the cells in the range
            $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);

            // create upper left cell if it does not already exist
            $upperLeft = $aReferences[0];
            if (!$this->cellExists($upperLeft)) {
                $this->getCell($upperLeft)->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
            }

            // create or blank out the rest of the cells in the range
            $count = count($aReferences);
            for ($i = 1; $i < $count; $i++) {
                $this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
            }

        } else {
            throw new PHPExcel_Exception('Merge must be set on a range of cells.');
        }

        return $this;
    }
public function mergeCells($pRange = 'A1:A1')
    {
        // Uppercase coordinate
        $pRange = strtoupper($pRange);

        if (strpos($pRange,':') !== false) {
            $this->_mergeCells[$pRange] = $pRange;

            // make sure cells are created

            // get the cells in the range
            $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);

            // create upper left cell if it does not already exist
            $upperLeft = $aReferences[0];
            if (!$this->cellExists($upperLeft)) {
                $this->getCell($upperLeft)->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
            }

            // create or blank out the rest of the cells in the range
            $count = count($aReferences);
            for ($i = 1; $i < $count; $i++) {
                $this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
            }

        } else {
            throw new PHPExcel_Exception('Merge must be set on a range of cells.');
        }

        return $this;
    }
public function mergeCells ( $ pRange = 'A1:A1' ) { // Uppercase coordinate $ pRange = strtoupper ( $ pRange ) ; if ( strpos ( $ pRange , ':' ) !== false ) { $ this -> _mergeCells [ $ pRange ] = $ pRange ; // make sure cells are created // get the cells in the range $ aReferences = PHPExcel_Cell :: extractAllCellReferencesInRange ( $ pRange ) ; // create upper left cell if it does not already exist $ upperLeft = $ aReferences [ 0 ] ; if ( ! $ this -> cellExists ( $ upperLeft ) ) { $ this -> getCell ( $ upperLeft ) -> setValueExplicit ( null , PHPExcel_Cell_DataType :: TYPE_NULL ) ; } // create or blank out the rest of the cells in the range $ count = count ( $ aReferences ) ; for ( $ i = 1 ; $ i < $ count ; $ i ++ ) { $ this -> getCell ( $ aReferences [ $ i ] ) -> setValueExplicit ( null , PHPExcel_Cell_DataType :: TYPE_NULL ) ; } } else { throw new PHPExcel_Exception ( 'Merge must be set on a range of cells.' ) ; } return $ this ; }
Set merge on a cell range

@param string $pRange  Cell range (e.g. A1:E1)
@throws PHPExcel_Exception
@return PHPExcel_Worksheet
Set merge on a cell range