Additional work on GH-161 for Breaks
This commit is contained in:
parent
15bfe6b8d5
commit
db1fcd5cd6
|
@ -68,7 +68,15 @@ class PHPExcel_ReferenceHelper
|
|||
protected function __construct() {
|
||||
}
|
||||
|
||||
private function cellSort($a, $b) {
|
||||
public static function columnSort($a, $b) {
|
||||
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||
}
|
||||
|
||||
public static function columnReverseSort($a, $b) {
|
||||
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||
}
|
||||
|
||||
public static function cellSort($a, $b) {
|
||||
list($ac,$ar) = sscanf($a,'%[A-Z]%d');
|
||||
list($bc,$br) = sscanf($b,'%[A-Z]%d');
|
||||
|
||||
|
@ -78,7 +86,7 @@ class PHPExcel_ReferenceHelper
|
|||
return ($ar < $br) ? -1 : 1;
|
||||
}
|
||||
|
||||
private function cellReverseSort($a, $b) {
|
||||
public static function cellReverseSort($a, $b) {
|
||||
list($ac,$ar) = sscanf($a,'%[A-Z]%d');
|
||||
list($bc,$br) = sscanf($b,'%[A-Z]%d');
|
||||
|
||||
|
@ -276,8 +284,8 @@ class PHPExcel_ReferenceHelper
|
|||
foreach ($aBreaks as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setBreak( $newReference, $value );
|
||||
$pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE );
|
||||
$pSheet->setBreak($newReference, $value)
|
||||
->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1604,7 +1604,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||
$pCell = strtoupper($pCell);
|
||||
|
||||
if ($pCell != '') {
|
||||
$this->_breaks[$pCell] = $pBreak;
|
||||
if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) {
|
||||
if (isset($this->_breaks[$pCell])) {
|
||||
unset($this->_breaks[$pCell]);
|
||||
}
|
||||
} else {
|
||||
$this->_breaks[$pCell] = $pBreak;
|
||||
}
|
||||
} else {
|
||||
throw new PHPExcel_Exception('No cell coordinate specified.');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue