|
@@ 152-169 (lines=18) @@
|
| 149 |
|
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns |
| 150 |
|
* @return integer The number of columns in cellAddress |
| 151 |
|
*/ |
| 152 |
|
public static function COLUMNS($cellAddress=Null) { |
| 153 |
|
if (is_null($cellAddress) || $cellAddress === '') { |
| 154 |
|
return 1; |
| 155 |
|
} elseif (!is_array($cellAddress)) { |
| 156 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 157 |
|
} |
| 158 |
|
|
| 159 |
|
$x = array_keys($cellAddress); |
| 160 |
|
$x = array_shift($x); |
| 161 |
|
$isMatrix = (is_numeric($x)); |
| 162 |
|
list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); |
| 163 |
|
|
| 164 |
|
if ($isMatrix) { |
| 165 |
|
return $rows; |
| 166 |
|
} else { |
| 167 |
|
return $columns; |
| 168 |
|
} |
| 169 |
|
} // function COLUMNS() |
| 170 |
|
|
| 171 |
|
|
| 172 |
|
/** |
|
@@ 227-243 (lines=17) @@
|
| 224 |
|
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows |
| 225 |
|
* @return integer The number of rows in cellAddress |
| 226 |
|
*/ |
| 227 |
|
public static function ROWS($cellAddress=Null) { |
| 228 |
|
if (is_null($cellAddress) || $cellAddress === '') { |
| 229 |
|
return 1; |
| 230 |
|
} elseif (!is_array($cellAddress)) { |
| 231 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 232 |
|
} |
| 233 |
|
|
| 234 |
|
$i = array_keys($cellAddress); |
| 235 |
|
$isMatrix = (is_numeric(array_shift($i))); |
| 236 |
|
list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); |
| 237 |
|
|
| 238 |
|
if ($isMatrix) { |
| 239 |
|
return $columns; |
| 240 |
|
} else { |
| 241 |
|
return $rows; |
| 242 |
|
} |
| 243 |
|
} // function ROWS() |
| 244 |
|
|
| 245 |
|
|
| 246 |
|
/** |