mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-12-01 17:56:04 +03:00
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() {
|
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($ac,$ar) = sscanf($a,'%[A-Z]%d');
|
||||||
list($bc,$br) = sscanf($b,'%[A-Z]%d');
|
list($bc,$br) = sscanf($b,'%[A-Z]%d');
|
||||||
|
|
||||||
@ -78,7 +86,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
return ($ar < $br) ? -1 : 1;
|
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($ac,$ar) = sscanf($a,'%[A-Z]%d');
|
||||||
list($bc,$br) = sscanf($b,'%[A-Z]%d');
|
list($bc,$br) = sscanf($b,'%[A-Z]%d');
|
||||||
|
|
||||||
@ -276,8 +284,8 @@ class PHPExcel_ReferenceHelper
|
|||||||
foreach ($aBreaks as $key => $value) {
|
foreach ($aBreaks as $key => $value) {
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
if ($key != $newReference) {
|
if ($key != $newReference) {
|
||||||
$pSheet->setBreak( $newReference, $value );
|
$pSheet->setBreak($newReference, $value)
|
||||||
$pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE );
|
->setBreak($key, PHPExcel_Worksheet::BREAK_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1604,7 +1604,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$pCell = strtoupper($pCell);
|
$pCell = strtoupper($pCell);
|
||||||
|
|
||||||
if ($pCell != '') {
|
if ($pCell != '') {
|
||||||
|
if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) {
|
||||||
|
if (isset($this->_breaks[$pCell])) {
|
||||||
|
unset($this->_breaks[$pCell]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$this->_breaks[$pCell] = $pBreak;
|
$this->_breaks[$pCell] = $pBreak;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception('No cell coordinate specified.');
|
throw new PHPExcel_Exception('No cell coordinate specified.');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user