private function _writeMergedCells()
	{
		$mergeCells = $this->_phpSheet->getMergeCells();
		$countMergeCells = count($mergeCells);

		if ($countMergeCells == 0) {
			return;
		}

		// maximum allowed number of merged cells per record
		$maxCountMergeCellsPerRecord = 1027;

		// record identifier
		$record = 0x00E5;

		// counter for total number of merged cells treated so far by the writer
		$i = 0;

		// counter for number of merged cells written in record currently being written
		$j = 0;

		// initialize record data
		$recordData = '';

		// loop through the merged cells
		foreach ($mergeCells as $mergeCell) {
			++$i;
			++$j;

			// extract the row and column indexes
			$range = PHPExcel_Cell::splitRange($mergeCell);
			list($first, $last) = $range[0];
			list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first);
			list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last);

			$recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1);

			// flush record if we have reached limit for number of merged cells, or reached final merged cell
			if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
				$recordData = pack('v', $j) . $recordData;
				$length = strlen($recordData);
				$header = pack('vv', $record, $length);
				$this->_append($header . $recordData);

				// initialize for next record, if any
				$recordData = '';
				$j = 0;
			}
		}
	}
private function _writeMergedCells()
	{
		$mergeCells = $this->_phpSheet->getMergeCells();
		$countMergeCells = count($mergeCells);

		if ($countMergeCells == 0) {
			return;
		}

		// maximum allowed number of merged cells per record
		$maxCountMergeCellsPerRecord = 1027;

		// record identifier
		$record = 0x00E5;

		// counter for total number of merged cells treated so far by the writer
		$i = 0;

		// counter for number of merged cells written in record currently being written
		$j = 0;

		// initialize record data
		$recordData = '';

		// loop through the merged cells
		foreach ($mergeCells as $mergeCell) {
			++$i;
			++$j;

			// extract the row and column indexes
			$range = PHPExcel_Cell::splitRange($mergeCell);
			list($first, $last) = $range[0];
			list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first);
			list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last);

			$recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1);

			// flush record if we have reached limit for number of merged cells, or reached final merged cell
			if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
				$recordData = pack('v', $j) . $recordData;
				$length = strlen($recordData);
				$header = pack('vv', $record, $length);
				$this->_append($header . $recordData);

				// initialize for next record, if any
				$recordData = '';
				$j = 0;
			}
		}
	}
private function _writeMergedCells ( ) { $ mergeCells = $ this -> _phpSheet -> getMergeCells ( ) ; $ countMergeCells = count ( $ mergeCells ) ; if ( $ countMergeCells == 0 ) { return ; } // maximum allowed number of merged cells per record $ maxCountMergeCellsPerRecord = 1027 ; // record identifier $ record = 0x00E5 ; // counter for total number of merged cells treated so far by the writer $ i = 0 ; // counter for number of merged cells written in record currently being written $ j = 0 ; // initialize record data $ recordData = '' ; // loop through the merged cells foreach ( $ mergeCells as $ mergeCell ) { ++ $ i ; ++ $ j ; // extract the row and column indexes $ range = PHPExcel_Cell :: splitRange ( $ mergeCell ) ; list ( $ first , $ last ) = $ range [ 0 ] ; list ( $ firstColumn , $ firstRow ) = PHPExcel_Cell :: coordinateFromString ( $ first ) ; list ( $ lastColumn , $ lastRow ) = PHPExcel_Cell :: coordinateFromString ( $ last ) ; $ recordData .= pack ( 'vvvv' , $ firstRow - 1 , $ lastRow - 1 , PHPExcel_Cell :: columnIndexFromString ( $ firstColumn ) - 1 , PHPExcel_Cell :: columnIndexFromString ( $ lastColumn ) - 1 ) ; // flush record if we have reached limit for number of merged cells, or reached final merged cell if ( $ j == $ maxCountMergeCellsPerRecord or $ i == $ countMergeCells ) { $ recordData = pack ( 'v' , $ j ) . $ recordData ; $ length = strlen ( $ recordData ) ; $ header = pack ( 'vv' , $ record , $ length ) ; $ this -> _append ( $ header . $ recordData ) ; // initialize for next record, if any $ recordData = '' ; $ j = 0 ; } } }
Store the MERGEDCELLS records for all ranges of merged cells
Store the MERGEDCELLS records for all ranges of merged cells