Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Ensure that range related functions had a valid range to work with #29

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Classes/PHPExcel/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ class PHPExcel_Cell
*/
private static $_valueBinder = NULL;


/**
* Default range variable constant
*
* @var string
*/
const DEFAULT_RANGE = 'A1:A1';

/**
* Column of the cell
*
Expand Down Expand Up @@ -600,6 +608,11 @@ public static function absoluteCoordinate($pCoordinateString = 'A1')
*/
public static function splitRange($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)){
$pRange = self::DEFAULT_RANGE;
}

$exploded = explode(',', $pRange);
$counter = count($exploded);
for ($i = 0; $i < $counter; ++$i) {
Expand Down Expand Up @@ -642,6 +655,11 @@ public static function buildRange($pRange)
*/
public static function rangeBoundaries($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)){
$pRange = self::DEFAULT_RANGE;
}

// Uppercase coordinate
$pRange = strtoupper($pRange);

Expand Down Expand Up @@ -686,6 +704,11 @@ public static function rangeDimension($pRange = 'A1:A1')
*/
public static function getRangeBoundaries($pRange = 'A1:A1')
{
// Ensure $pRange is a valid range
if(empty($pRange)){
$pRange = self::DEFAULT_VALUE;
}

// Uppercase coordinate
$pRange = strtoupper($pRange);

Expand Down
3 changes: 2 additions & 1 deletion Classes/PHPExcel/ReferenceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, P


// Update worksheet: autofilter
if ($pSheet->getAutoFilter()->getRange() !== '') {
$range = $pSheet->getAutoFilter()->getRange();
if (!empty($range)) {
$pSheet->setAutoFilter( $this->updateCellReference($pSheet->getAutoFilter()->getRange(), $pBefore, $pNumCols, $pNumRows) );
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPExcel/Writer/Excel5.php
Original file line number Diff line number Diff line change
Expand Up @@ -958,4 +958,4 @@ private function _writeSummaryInformation(){

return $data;
}
}
}