@@ 146-163 (lines=18) @@ | ||
143 | * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns |
|
144 | * @return integer The number of columns in cellAddress |
|
145 | */ |
|
146 | public static function COLUMNS($cellAddress = null) |
|
147 | { |
|
148 | if (is_null($cellAddress) || $cellAddress === '') { |
|
149 | return 1; |
|
150 | } elseif (!is_array($cellAddress)) { |
|
151 | return Functions::VALUE(); |
|
152 | } |
|
153 | ||
154 | reset($cellAddress); |
|
155 | $isMatrix = (is_numeric(key($cellAddress))); |
|
156 | list($columns, $rows) = \PhpSpreadsheet\Calculation::_getMatrixDimensions($cellAddress); |
|
157 | ||
158 | if ($isMatrix) { |
|
159 | return $rows; |
|
160 | } else { |
|
161 | return $columns; |
|
162 | } |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
@@ 224-241 (lines=18) @@ | ||
221 | * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows |
|
222 | * @return integer The number of rows in cellAddress |
|
223 | */ |
|
224 | public static function ROWS($cellAddress = null) |
|
225 | { |
|
226 | if (is_null($cellAddress) || $cellAddress === '') { |
|
227 | return 1; |
|
228 | } elseif (!is_array($cellAddress)) { |
|
229 | return Functions::VALUE(); |
|
230 | } |
|
231 | ||
232 | reset($cellAddress); |
|
233 | $isMatrix = (is_numeric(key($cellAddress))); |
|
234 | list($columns, $rows) = \PhpSpreadsheet\Calculation::_getMatrixDimensions($cellAddress); |
|
235 | ||
236 | if ($isMatrix) { |
|
237 | return $columns; |
|
238 | } else { |
|
239 | return $rows; |
|
240 | } |
|
241 | } |
|
242 | ||
243 | ||
244 | /** |