示例#1
0
 /**
  *	ROWS
  *
  *	Returns the number of rows in an array or reference.
  *
  *	@param	cellAddress		An array or array formula, or a reference to a range of cells for which you want the number of rows
  *	@return	integer
  */
 public static function ROWS($cellAddress = Null)
 {
     if (is_null($cellAddress) || $cellAddress === '') {
         return 1;
     } elseif (!is_array($cellAddress)) {
         return PHPExcel_Calculation_Functions::VALUE();
     }
     $i = array_keys($cellAddress);
     $isMatrix = is_numeric(array_shift($i));
     list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
     if ($isMatrix) {
         return $columns;
     } else {
         return $rows;
     }
 }
示例#2
0
 /**
  *	ROWS
  *
  *	Returns the number of rows in an array or reference.
  *
  *	@param	cellAddress		An array or array formula, or a reference to a range of cells for which you want the number of rows
  *	@return	integer
  */
 public static function ROWS($cellAddress = Null)
 {
     if (is_null($cellAddress) || $cellAddress === '') {
         return 0;
     } elseif (!is_array($cellAddress)) {
         return self::$_errorCodes['value'];
     }
     $isMatrix = is_numeric(array_shift(array_keys($cellAddress)));
     list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
     if ($isMatrix) {
         return $columns;
     } else {
         return $rows;
     }
 }