public static function PHPExcel_Cell::extractAllCellReferencesInRange in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell.php \PHPExcel_Cell::extractAllCellReferencesInRange()
* Extract all cell references in range * *
Parameters
string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25): * @return array Array containing single cell references
8 calls to PHPExcel_Cell::extractAllCellReferencesInRange()
- PHPExcel_Calculation::extractCellRange in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation.php - * Extract range values * *
- PHPExcel_Calculation::extractNamedRange in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation.php - * Extract range values * *
- PHPExcel_Reader_Excel2007::load in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel2007.php - * Loads PHPExcel from file * *
- PHPExcel_Reader_Excel5::_readDataValidation in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php - * Read DATAVALIDATION record
- PHPExcel_Reader_Excel5::_readHyperLink in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php - * Read HYPERLINK record
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Cell.php, line 854
Class
- PHPExcel_Cell
- PHPExcel_Cell
Code
public static function extractAllCellReferencesInRange($pRange = 'A1') {
// Returnvalue
$returnValue = array();
// Explode spaces
$cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange)));
foreach ($cellBlocks as $cellBlock) {
// Single cell?
if (strpos($cellBlock, ':') === FALSE && strpos($cellBlock, ',') === FALSE) {
$returnValue[] = $cellBlock;
continue;
}
// Range...
$ranges = self::splitRange($cellBlock);
foreach ($ranges as $range) {
// Single cell?
if (!isset($range[1])) {
$returnValue[] = $range[0];
continue;
}
// Range...
list($rangeStart, $rangeEnd) = $range;
sscanf($rangeStart, '%[A-Z]%d', $startCol, $startRow);
sscanf($rangeEnd, '%[A-Z]%d', $endCol, $endRow);
$endCol++;
// Current data
$currentCol = $startCol;
$currentRow = $startRow;
// Loop cells
while ($currentCol != $endCol) {
while ($currentRow <= $endRow) {
$returnValue[] = $currentCol . $currentRow;
++$currentRow;
}
++$currentCol;
$currentRow = $startRow;
}
}
}
// Sort the result by column and row
$sortKeys = array();
foreach (array_unique($returnValue) as $coord) {
sscanf($coord, '%[A-Z]%d', $column, $row);
$sortKeys[sprintf('%3s%09d', $column, $row)] = $coord;
}
ksort($sortKeys);
// Return value
return array_values($sortKeys);
}