public static function PHPExcel_Calculation_LookupRef::ROW in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php \PHPExcel_Calculation_LookupRef::ROW()
* ROW * * Returns the row number of the given cell reference * If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array. * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the * reference of the cell in which the ROW function appears; otherwise this function returns 0. * * Excel Function: * =ROW([cellAddress]) * *
Parameters
cellAddress A reference to a range of cells for which you want the row numbers: * @return integer or array of integer
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ LookupRef.php, line 186
Class
- PHPExcel_Calculation_LookupRef
- PHPExcel_Calculation_LookupRef
Code
public static function ROW($cellAddress = Null) {
if (is_null($cellAddress) || trim($cellAddress) === '') {
return 0;
}
if (is_array($cellAddress)) {
foreach ($cellAddress as $columnKey => $rowValue) {
foreach ($rowValue as $rowKey => $cellValue) {
return (int) preg_replace('/[^0-9]/i', '', $rowKey);
}
}
}
else {
if (strpos($cellAddress, '!') !== false) {
list($sheet, $cellAddress) = explode('!', $cellAddress);
}
if (strpos($cellAddress, ':') !== false) {
list($startAddress, $endAddress) = explode(':', $cellAddress);
$startAddress = preg_replace('/[^0-9]/', '', $startAddress);
$endAddress = preg_replace('/[^0-9]/', '', $endAddress);
$returnValue = array();
do {
$returnValue[][] = (int) $startAddress;
} while ($startAddress++ != $endAddress);
return $returnValue;
}
else {
list($cellAddress) = explode(':', $cellAddress);
return (int) preg_replace('/[^0-9]/', '', $cellAddress);
}
}
}