private function _writeBreaks()
	{
		// initialize
		$vbreaks = array();
		$hbreaks = array();

		foreach ($this->_phpSheet->getBreaks() as $cell => $breakType) {
			// Fetch coordinates
			$coordinates = PHPExcel_Cell::coordinateFromString($cell);

			// Decide what to do by the type of break
			switch ($breakType) {
				case PHPExcel_Worksheet::BREAK_COLUMN:
					// Add to list of vertical breaks
					$vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
					break;

				case PHPExcel_Worksheet::BREAK_ROW:
					// Add to list of horizontal breaks
					$hbreaks[] = $coordinates[1];
					break;

				case PHPExcel_Worksheet::BREAK_NONE:
				default:
					// Nothing to do
					break;
			}
		}

		//horizontal page breaks
		if (!empty($hbreaks)) {

			// Sort and filter array of page breaks
			sort($hbreaks, SORT_NUMERIC);
			if ($hbreaks[0] == 0) { // don't use first break if it's 0
				array_shift($hbreaks);
			}

			$record  = 0x001b;			   // Record identifier
			$cbrk	= count($hbreaks);	   // Number of page breaks
			$length  = 2 + 6 * $cbrk;	  // Bytes to follow

			$header  = pack("vv", $record, $length);
			$data	= pack("v",  $cbrk);

			// Append each page break
			foreach ($hbreaks as $hbreak) {
				$data .= pack("vvv", $hbreak, 0x0000, 0x00ff);
			}

			$this->_append($header . $data);
		}

		// vertical page breaks
		if (!empty($vbreaks)) {

			// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
			// It is slightly higher in Excel 97/200, approx. 1026
			$vbreaks = array_slice($vbreaks, 0, 1000);

			// Sort and filter array of page breaks
			sort($vbreaks, SORT_NUMERIC);
			if ($vbreaks[0] == 0) { // don't use first break if it's 0
				array_shift($vbreaks);
			}

			$record  = 0x001a;			   // Record identifier
			$cbrk	= count($vbreaks);	   // Number of page breaks
			$length  = 2 + 6 * $cbrk;	  // Bytes to follow

			$header  = pack("vv",  $record, $length);
			$data	= pack("v",   $cbrk);

			// Append each page break
			foreach ($vbreaks as $vbreak) {
				$data .= pack("vvv", $vbreak, 0x0000, 0xffff);
			}

			$this->_append($header . $data);
		}
	}
private function _writeBreaks()
	{
		// initialize
		$vbreaks = array();
		$hbreaks = array();

		foreach ($this->_phpSheet->getBreaks() as $cell => $breakType) {
			// Fetch coordinates
			$coordinates = PHPExcel_Cell::coordinateFromString($cell);

			// Decide what to do by the type of break
			switch ($breakType) {
				case PHPExcel_Worksheet::BREAK_COLUMN:
					// Add to list of vertical breaks
					$vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
					break;

				case PHPExcel_Worksheet::BREAK_ROW:
					// Add to list of horizontal breaks
					$hbreaks[] = $coordinates[1];
					break;

				case PHPExcel_Worksheet::BREAK_NONE:
				default:
					// Nothing to do
					break;
			}
		}

		//horizontal page breaks
		if (!empty($hbreaks)) {

			// Sort and filter array of page breaks
			sort($hbreaks, SORT_NUMERIC);
			if ($hbreaks[0] == 0) { // don't use first break if it's 0
				array_shift($hbreaks);
			}

			$record  = 0x001b;			   // Record identifier
			$cbrk	= count($hbreaks);	   // Number of page breaks
			$length  = 2 + 6 * $cbrk;	  // Bytes to follow

			$header  = pack("vv", $record, $length);
			$data	= pack("v",  $cbrk);

			// Append each page break
			foreach ($hbreaks as $hbreak) {
				$data .= pack("vvv", $hbreak, 0x0000, 0x00ff);
			}

			$this->_append($header . $data);
		}

		// vertical page breaks
		if (!empty($vbreaks)) {

			// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
			// It is slightly higher in Excel 97/200, approx. 1026
			$vbreaks = array_slice($vbreaks, 0, 1000);

			// Sort and filter array of page breaks
			sort($vbreaks, SORT_NUMERIC);
			if ($vbreaks[0] == 0) { // don't use first break if it's 0
				array_shift($vbreaks);
			}

			$record  = 0x001a;			   // Record identifier
			$cbrk	= count($vbreaks);	   // Number of page breaks
			$length  = 2 + 6 * $cbrk;	  // Bytes to follow

			$header  = pack("vv",  $record, $length);
			$data	= pack("v",   $cbrk);

			// Append each page break
			foreach ($vbreaks as $vbreak) {
				$data .= pack("vvv", $vbreak, 0x0000, 0xffff);
			}

			$this->_append($header . $data);
		}
	}
private function _writeBreaks ( ) { // initialize $ vbreaks = array ( ) ; $ hbreaks = array ( ) ; foreach ( $ this -> _phpSheet -> getBreaks ( ) as $ cell => $ breakType ) { // Fetch coordinates $ coordinates = PHPExcel_Cell :: coordinateFromString ( $ cell ) ; // Decide what to do by the type of break switch ( $ breakType ) { case PHPExcel_Worksheet :: BREAK_COLUMN : // Add to list of vertical breaks $ vbreaks [ ] = PHPExcel_Cell :: columnIndexFromString ( $ coordinates [ 0 ] ) - 1 ; break ; case PHPExcel_Worksheet :: BREAK_ROW : // Add to list of horizontal breaks $ hbreaks [ ] = $ coordinates [ 1 ] ; break ; case PHPExcel_Worksheet :: BREAK_NONE : default : // Nothing to do break ; } } //horizontal page breaks if ( ! empty ( $ hbreaks ) ) { // Sort and filter array of page breaks sort ( $ hbreaks , SORT_NUMERIC ) ; if ( $ hbreaks [ 0 ] == 0 ) { // don't use first break if it's 0 array_shift ( $ hbreaks ) ; } $ record = 0x001b ; // Record identifier $ cbrk = count ( $ hbreaks ) ; // Number of page breaks $ length = 2 + 6 * $ cbrk ; // Bytes to follow $ header = pack ( "vv" , $ record , $ length ) ; $ data = pack ( "v" , $ cbrk ) ; // Append each page break foreach ( $ hbreaks as $ hbreak ) { $ data .= pack ( "vvv" , $ hbreak , 0x0000 , 0x00ff ) ; } $ this -> _append ( $ header . $ data ) ; } // vertical page breaks if ( ! empty ( $ vbreaks ) ) { // 1000 vertical pagebreaks appears to be an internal Excel 5 limit. // It is slightly higher in Excel 97/200, approx. 1026 $ vbreaks = array_slice ( $ vbreaks , 0 , 1000 ) ; // Sort and filter array of page breaks sort ( $ vbreaks , SORT_NUMERIC ) ; if ( $ vbreaks [ 0 ] == 0 ) { // don't use first break if it's 0 array_shift ( $ vbreaks ) ; } $ record = 0x001a ; // Record identifier $ cbrk = count ( $ vbreaks ) ; // Number of page breaks $ length = 2 + 6 * $ cbrk ; // Bytes to follow $ header = pack ( "vv" , $ record , $ length ) ; $ data = pack ( "v" , $ cbrk ) ; // Append each page break foreach ( $ vbreaks as $ vbreak ) { $ data .= pack ( "vvv" , $ vbreak , 0x0000 , 0xffff ) ; } $ this -> _append ( $ header . $ data ) ; } }
Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records.
Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records .