Reads a cell range address in BIFF8 for shared formulas. Uses positive and negative values for row and column
to indicate offsets from a base cell
section 3.3.4

@param string $subData
@param string $baseCell Base cell
@return string Cell range address
332991
private function _readBIFF8CellRangeAddressB($subData, $baseCell = 'A1')
	{
		list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell);
		$baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1;

		// TODO: if cell range is just a single cell, should this funciton
		// not just return e.g. 'A1' and not 'A1:A1' ?

		// offset: 0; size: 2; first row
		$frIndex = self::_GetInt2d($subData, 0); // adjust below

		// offset: 2; size: 2; relative index to first row (0... 65535) should be treated as offset (-32768... 32767)
		$lrIndex = self::_GetInt2d($subData, 2); // adjust below

		// offset: 4; size: 2; first column with relative/absolute flags

		// bit: 7-0; mask 0x00FF; column index
		$fcIndex = 0x00FF & self::_GetInt2d($subData, 4);

		// bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
		if (!(0x4000 & self::_GetInt2d($subData, 4))) {
			// absolute column index
			$fc = PHPExcel_Cell::stringFromColumnIndex($fcIndex);
			$fc = '$' . $fc;
		} else {
			// column offset
			$fcIndex = ($fcIndex <= 127) ? $fcIndex : $fcIndex - 256;
			$fc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $fcIndex);
		}

		// bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
		if (!(0x8000 & self::_GetInt2d($subData, 4))) {
			// absolute row index
			$fr = $frIndex + 1;
			$fr = '$' . $fr;
		} else {
			// row offset
			$frIndex = ($frIndex <= 32767) ? $frIndex : $frIndex - 65536;
			$fr = $baseRow + $frIndex;
		}

		// offset: 6; size: 2; last column with relative/absolute flags

		// bit: 7-0; mask 0x00FF; column index
		$lcIndex = 0x00FF & self::_GetInt2d($subData, 6);
		$lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256;
		$lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex);

		// bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
		if (!(0x4000 & self::_GetInt2d($subData, 6))) {
			// absolute column index
			$lc = PHPExcel_Cell::stringFromColumnIndex($lcIndex);
			$lc = '$' . $lc;
		} else {
			// column offset
			$lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256;
			$lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex);
		}

		// bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
		if (!(0x8000 & self::_GetInt2d($subData, 6))) {
			// absolute row index
			$lr = $lrIndex + 1;
			$lr = '$' . $lr;
		} else {
			// row offset
			$lrIndex = ($lrIndex <= 32767) ? $lrIndex : $lrIndex - 65536;
			$lr = $baseRow + $lrIndex;
		}

		return "$fc$fr:$lc$lr";
	}
1093592
public function auto(
            array $cellsData, 
            int   $nbColsByRow = null, 
            bool  $container = false, 
            array $classes = [], 
            array $attrs = [], 
            array $containerClasses = [], 
            bool  $fluid = true):string
    {
        $nbColsByRow = $nbColsByRow ?? count($cellsData);
        $src = $this->autoStart($nbColsByRow, $container, $fluid, $containerClasses);
        foreach ($cellsData as $cell) {
            $src .= $this->autoNewCol(1, $classes, $attrs);
            $src .= (string) $cell;
        }
        $src .= $this->autoStop();
        return $src;
    }
711629
protected function _getBaseStringFromText(array $data, array $baseField) {
        $col = $baseField['column'];
        if (!array_key_exists($col, $data)) {
            return '';
        }
        return $data[$col];
    }
452441
private function _readByteStringLong($subData)
	{
		// offset: 0; size: 2; length of the string (character count)
		$ln = self::_GetInt2d($subData, 0);

		// offset: 2: size: var; character array (8-bit characters)
		$value = $this->_decodeCodepage(substr($subData, 2));

		//return $string;
		return array(
			'value' => $value,
			'size' => 2 + $ln, // size in bytes of data structure
		);
	}
1111771
private function loadData($my_std_class,$property,$subProperty)
    {
        if(property_exists($my_std_class,$property))
        {
            return $my_std_class->$property->{'@attributes'}->$subProperty;

        }

    }
501719
private function _getProductsData(Kwf_Component_Data $subroot = null)
    {
        $ret = array();

        $items = $this->getChildRows('Products');
        $ret = array();

        foreach ($items as $i) {
            $data = Kwc_Shop_VoucherProduct_AddToCart_OrderProductData::getInstance($i->add_component_class);
            $r = array(
                'id' => $i->id,
                'additionalOrderData' => $data->getAdditionalOrderData($i),
                'price' => $this->_getProductPrice($i),
                'amount' => $data->getAmount($i),
                'text' => $data->getProductText($i),
            );
            if ($subroot) {
                $addComponent = Kwc_Shop_AddToCartAbstract_OrderProductData::getAddComponentByDbId(
                    $i->add_component_id, $subroot
                );
                if (!$addComponent) {
                    //product doesn't exist anymore, also delete from cart
                    $i->delete();
                    continue;
                } else {
                    $r['product'] = $addComponent->parent;
                    $r['text'] = $addComponent->getComponent()->getProductText($i);
                }
            }
            $ret[] = (object)$r;
        }
        return $ret;
    }
161479
public static String getCellAddressA1Format(int rowNum, int columnNum) {
 CellAddress cellAddr = new CellAddress(rowNum, columnNum);
 return cellAddr.formatAsString();
}
1236874
private function _readFormula()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		// offset: 0; size: 2; row index
		$row = self::_GetInt2d($recordData, 0);

		// offset: 2; size: 2; col index
		$column = self::_GetInt2d($recordData, 2);
		$columnString = PHPExcel_Cell::stringFromColumnIndex($column);

		// offset: 20: size: variable; formula structure
		$formulaStructure = substr($recordData, 20);

		// offset: 14: size: 2; option flags, recalculate always, recalculate on open etc.
		$options = self::_GetInt2d($recordData, 14);

		// bit: 0; mask: 0x0001; 1 = recalculate always
		// bit: 1; mask: 0x0002; 1 = calculate on open
		// bit: 2; mask: 0x0008; 1 = part of a shared formula
		$isPartOfSharedFormula = (bool) (0x0008 & $options);

		// WARNING:
		// We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true
		// the formula data may be ordinary formula data, therefore we need to check
		// explicitly for the tExp token (0x01)
		$isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure{2}) == 0x01;

		if ($isPartOfSharedFormula) {
			// part of shared formula which means there will be a formula with a tExp token and nothing else
			// get the base cell, grab tExp token
			$baseRow = self::_GetInt2d($formulaStructure, 3);
			$baseCol = self::_GetInt2d($formulaStructure, 5);
			$this->_baseCell = PHPExcel_Cell::stringFromColumnIndex($baseCol). ($baseRow + 1);
		}

		// Read cell?
		if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {

			if ($isPartOfSharedFormula) {
				// formula is added to this cell after the sheet has been read
				$this->_sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell;
			}

			// offset: 16: size: 4; not used

			// offset: 4; size: 2; XF index
			$xfIndex = self::_GetInt2d($recordData, 4);

			// offset: 6; size: 8; result of the formula
			if ( (ord($recordData{6}) == 0)
				&& (ord($recordData{12}) == 255)
				&& (ord($recordData{13}) == 255) ) {

				// String formula. Result follows in appended STRING record
				$dataType = PHPExcel_Cell_DataType::TYPE_STRING;

				// read possible SHAREDFMLA record
				$code = self::_GetInt2d($this->_data, $this->_pos);
				if ($code == self::XLS_Type_SHAREDFMLA) {
					$this->_readSharedFmla();
				}

				// read STRING record
				$value = $this->_readString();

			} elseif ((ord($recordData{6}) == 1)
				&& (ord($recordData{12}) == 255)
				&& (ord($recordData{13}) == 255)) {

				// Boolean formula. Result is in +2; 0=false, 1=true
				$dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
				$value = (bool) ord($recordData{8});

			} elseif ((ord($recordData{6}) == 2)
				&& (ord($recordData{12}) == 255)
				&& (ord($recordData{13}) == 255)) {

				// Error formula. Error code is in +2
				$dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
				$value = self::_mapErrorCode(ord($recordData{8}));

			} elseif ((ord($recordData{6}) == 3)
				&& (ord($recordData{12}) == 255)
				&& (ord($recordData{13}) == 255)) {

				// Formula result is a null string
				$dataType = PHPExcel_Cell_DataType::TYPE_NULL;
				$value = '';

			} else {

				// forumla result is a number, first 14 bytes like _NUMBER record
				$dataType = PHPExcel_Cell_DataType::TYPE_NUMERIC;
				$value = self::_extractNumber(substr($recordData, 6, 8));

			}

			$cell = $this->_phpSheet->getCell($columnString . ($row + 1));
			if (!$this->_readDataOnly) {
				// add cell style
				$cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
			}

			// store the formula
			if (!$isPartOfSharedFormula) {
				// not part of shared formula
				// add cell value. If we can read formula, populate with formula, otherwise just used cached value
				try {
					if ($this->_version != self::XLS_BIFF8) {
						throw new PHPExcel_Reader_Exception('Not BIFF8. Can only read BIFF8 formulas');
					}
					$formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language
					$cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);

				} catch (PHPExcel_Exception $e) {
					$cell->setValueExplicit($value, $dataType);
				}
			} else {
				if ($this->_version == self::XLS_BIFF8) {
					// do nothing at this point, formula id added later in the code
				} else {
					$cell->setValueExplicit($value, $dataType);
				}
			}

			// store the cached calculated value
			$cell->setCalculatedValue($value);
		}
	}
649787
private static function _readUnicodeStringLong($subData)
	{
		$value = '';

		// offset: 0: size: 2; length of the string (character count)
		$characterCount = self::_GetInt2d($subData, 0);

		$string = self::_readUnicodeString(substr($subData, 2), $characterCount);

		// add 2 for the string length
		$string['size'] += 2;

		return $string;
	}
678341
public function calculateFieldInfo($currentValue, array $fieldData)
    {
        if (! $currentValue) {
            return $currentValue;
        }

        $lookup = $this->getLookup();

        if (isset($lookup[$currentValue])) {
            return $lookup[$currentValue];
        }

        return null;
    }
1292469
private function readBIFF8CellRangeAddressList($subData)
    {
        $cellRangeAddresses = array();

        // offset: 0; size: 2; number of the following cell range addresses
        $nm = self::getInt2d($subData, 0);

        $offset = 2;
        // offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses
        for ($i = 0; $i < $nm; ++$i) {
            $cellRangeAddresses[] = $this->readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8));
            $offset += 8;
        }

        return array(
            'size' => 2 + 8 * $nm,
            'cellRangeAddresses' => $cellRangeAddresses,
        );
    }
1170690
private function _getNextToken($formulaData, $baseCell = 'A1')
	{
		// offset: 0; size: 1; token id
		$id = ord($formulaData[0]); // token id
		$name = false; // initialize token name

		switch ($id) {
		case 0x03: $name = 'tAdd';		$size = 1;	$data = '+';	break;
		case 0x04: $name = 'tSub';		$size = 1;	$data = '-';	break;
		case 0x05: $name = 'tMul';		$size = 1;	$data = '*';	break;
		case 0x06: $name = 'tDiv';		$size = 1;	$data = '/';	break;
		case 0x07: $name = 'tPower';	$size = 1;	$data = '^';	break;
		case 0x08: $name = 'tConcat';	$size = 1;	$data = '&';	break;
		case 0x09: $name = 'tLT';		$size = 1;	$data = '<';	break;
		case 0x0A: $name = 'tLE';		$size = 1;	$data = '<=';	break;
		case 0x0B: $name = 'tEQ';		$size = 1;	$data = '=';	break;
		case 0x0C: $name = 'tGE';		$size = 1;	$data = '>=';	break;
		case 0x0D: $name = 'tGT';		$size = 1;	$data = '>';	break;
		case 0x0E: $name = 'tNE';		$size = 1;	$data = '<>';	break;
		case 0x0F: $name = 'tIsect';	$size = 1;	$data = ' ';	break;
		case 0x10: $name = 'tList';		$size = 1;	$data = ',';	break;
		case 0x11: $name = 'tRange';	$size = 1;	$data = ':';	break;
		case 0x12: $name = 'tUplus';	$size = 1;	$data = '+';	break;
		case 0x13: $name = 'tUminus';	$size = 1;	$data = '-';	break;
		case 0x14: $name = 'tPercent';	$size = 1;	$data = '%';	break;
		case 0x15:	//	parenthesis
			$name  = 'tParen';
			$size  = 1;
			$data = null;
			break;
		case 0x16:	//	missing argument
			$name = 'tMissArg';
			$size = 1;
			$data = '';
			break;
		case 0x17:	//	string
			$name = 'tStr';
			// offset: 1; size: var; Unicode string, 8-bit string length
			$string = self::_readUnicodeStringShort(substr($formulaData, 1));
			$size = 1 + $string['size'];
			$data = self::_UTF8toExcelDoubleQuoted($string['value']);
			break;
		case 0x19:	//	Special attribute
			// offset: 1; size: 1; attribute type flags:
			switch (ord($formulaData[1])) {
			case 0x01:
				$name = 'tAttrVolatile';
				$size = 4;
				$data = null;
				break;
			case 0x02:
				$name = 'tAttrIf';
				$size = 4;
				$data = null;
				break;
			case 0x04:
				$name = 'tAttrChoose';
				// offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1)
				$nc = self::_GetInt2d($formulaData, 2);
				// offset: 4; size: 2 * $nc
				// offset: 4 + 2 * $nc; size: 2
				$size = 2 * $nc + 6;
				$data = null;
				break;
			case 0x08:
				$name = 'tAttrSkip';
				$size = 4;
				$data = null;
				break;
			case 0x10:
				$name = 'tAttrSum';
				$size = 4;
				$data = null;
				break;
			case 0x40:
			case 0x41:
				$name = 'tAttrSpace';
				$size = 4;
				// offset: 2; size: 2; space type and position
				switch (ord($formulaData[2])) {
				case 0x00:
					$spacetype = 'type0';
					break;
				case 0x01:
					$spacetype = 'type1';
					break;
				case 0x02:
					$spacetype = 'type2';
					break;
				case 0x03:
					$spacetype = 'type3';
					break;
				case 0x04:
					$spacetype = 'type4';
					break;
				case 0x05:
					$spacetype = 'type5';
					break;
				default:
					throw new PHPExcel_Reader_Exception('Unrecognized space type in tAttrSpace token');
					break;
				}
				// offset: 3; size: 1; number of inserted spaces/carriage returns
				$spacecount = ord($formulaData[3]);

				$data = array('spacetype' => $spacetype, 'spacecount' => $spacecount);
				break;
			default:
				throw new PHPExcel_Reader_Exception('Unrecognized attribute flag in tAttr token');
				break;
			}
			break;
		case 0x1C:	//	error code
			// offset: 1; size: 1; error code
			$name = 'tErr';
			$size = 2;
			$data = self::_mapErrorCode(ord($formulaData[1]));
			break;
		case 0x1D:	//	boolean
			// offset: 1; size: 1; 0 = false, 1 = true;
			$name = 'tBool';
			$size = 2;
			$data = ord($formulaData[1]) ? 'TRUE' : 'FALSE';
			break;
		case 0x1E:	//	integer
			// offset: 1; size: 2; unsigned 16-bit integer
			$name = 'tInt';
			$size = 3;
			$data = self::_GetInt2d($formulaData, 1);
			break;
		case 0x1F:	//	number
			// offset: 1; size: 8;
			$name = 'tNum';
			$size = 9;
			$data = self::_extractNumber(substr($formulaData, 1));
			$data = str_replace(',', '.', (string)$data); // in case non-English locale
			break;
		case 0x20:	//	array constant
		case 0x40:
		case 0x60:
			// offset: 1; size: 7; not used
			$name = 'tArray';
			$size = 8;
			$data = null;
			break;
		case 0x21:	//	function with fixed number of arguments
		case 0x41:
		case 0x61:
			$name = 'tFunc';
			$size = 3;
			// offset: 1; size: 2; index to built-in sheet function
			switch (self::_GetInt2d($formulaData, 1)) {
			case   2: $function = 'ISNA'; 			$args = 1; 	break;
			case   3: $function = 'ISERROR'; 		$args = 1; 	break;
			case  10: $function = 'NA'; 			$args = 0; 	break;
			case  15: $function = 'SIN'; 			$args = 1; 	break;
			case  16: $function = 'COS'; 			$args = 1; 	break;
			case  17: $function = 'TAN'; 			$args = 1; 	break;
			case  18: $function = 'ATAN'; 			$args = 1; 	break;
			case  19: $function = 'PI'; 			$args = 0; 	break;
			case  20: $function = 'SQRT'; 			$args = 1; 	break;
			case  21: $function = 'EXP'; 			$args = 1; 	break;
			case  22: $function = 'LN'; 			$args = 1; 	break;
			case  23: $function = 'LOG10'; 			$args = 1; 	break;
			case  24: $function = 'ABS'; 			$args = 1; 	break;
			case  25: $function = 'INT'; 			$args = 1; 	break;
			case  26: $function = 'SIGN'; 			$args = 1; 	break;
			case  27: $function = 'ROUND'; 			$args = 2; 	break;
			case  30: $function = 'REPT'; 			$args = 2; 	break;
			case  31: $function = 'MID'; 			$args = 3; 	break;
			case  32: $function = 'LEN'; 			$args = 1; 	break;
			case  33: $function = 'VALUE'; 			$args = 1; 	break;
			case  34: $function = 'TRUE'; 			$args = 0; 	break;
			case  35: $function = 'FALSE'; 			$args = 0; 	break;
			case  38: $function = 'NOT'; 			$args = 1; 	break;
			case  39: $function = 'MOD'; 			$args = 2;	break;
			case  40: $function = 'DCOUNT'; 		$args = 3;	break;
			case  41: $function = 'DSUM'; 			$args = 3;	break;
			case  42: $function = 'DAVERAGE'; 		$args = 3;	break;
			case  43: $function = 'DMIN'; 			$args = 3;	break;
			case  44: $function = 'DMAX'; 			$args = 3;	break;
			case  45: $function = 'DSTDEV'; 		$args = 3;	break;
			case  48: $function = 'TEXT'; 			$args = 2;	break;
			case  61: $function = 'MIRR'; 			$args = 3;	break;
			case  63: $function = 'RAND'; 			$args = 0;	break;
			case  65: $function = 'DATE'; 			$args = 3;	break;
			case  66: $function = 'TIME'; 			$args = 3;	break;
			case  67: $function = 'DAY'; 			$args = 1;	break;
			case  68: $function = 'MONTH'; 			$args = 1;	break;
			case  69: $function = 'YEAR'; 			$args = 1;	break;
			case  71: $function = 'HOUR'; 			$args = 1;	break;
			case  72: $function = 'MINUTE'; 		$args = 1;	break;
			case  73: $function = 'SECOND'; 		$args = 1;	break;
			case  74: $function = 'NOW'; 			$args = 0;	break;
			case  75: $function = 'AREAS'; 			$args = 1;	break;
			case  76: $function = 'ROWS'; 			$args = 1;	break;
			case  77: $function = 'COLUMNS'; 		$args = 1;	break;
			case  83: $function = 'TRANSPOSE'; 		$args = 1;	break;
			case  86: $function = 'TYPE'; 			$args = 1;	break;
			case  97: $function = 'ATAN2'; 			$args = 2;	break;
			case  98: $function = 'ASIN'; 			$args = 1;	break;
			case  99: $function = 'ACOS'; 			$args = 1;	break;
			case 105: $function = 'ISREF'; 			$args = 1;	break;
			case 111: $function = 'CHAR'; 			$args = 1;	break;
			case 112: $function = 'LOWER'; 			$args = 1;	break;
			case 113: $function = 'UPPER'; 			$args = 1;	break;
			case 114: $function = 'PROPER'; 		$args = 1;	break;
			case 117: $function = 'EXACT'; 			$args = 2;	break;
			case 118: $function = 'TRIM'; 			$args = 1;	break;
			case 119: $function = 'REPLACE'; 		$args = 4;	break;
			case 121: $function = 'CODE'; 			$args = 1;	break;
			case 126: $function = 'ISERR'; 			$args = 1;	break;
			case 127: $function = 'ISTEXT'; 		$args = 1;	break;
			case 128: $function = 'ISNUMBER'; 		$args = 1;	break;
			case 129: $function = 'ISBLANK'; 		$args = 1;	break;
			case 130: $function = 'T'; 				$args = 1;	break;
			case 131: $function = 'N'; 				$args = 1;	break;
			case 140: $function = 'DATEVALUE'; 		$args = 1;	break;
			case 141: $function = 'TIMEVALUE'; 		$args = 1;	break;
			case 142: $function = 'SLN'; 			$args = 3;	break;
			case 143: $function = 'SYD'; 			$args = 4;	break;
			case 162: $function = 'CLEAN'; 			$args = 1;	break;
			case 163: $function = 'MDETERM'; 		$args = 1;	break;
			case 164: $function = 'MINVERSE'; 		$args = 1;	break;
			case 165: $function = 'MMULT'; 			$args = 2;	break;
			case 184: $function = 'FACT'; 			$args = 1;	break;
			case 189: $function = 'DPRODUCT'; 		$args = 3;	break;
			case 190: $function = 'ISNONTEXT'; 		$args = 1;	break;
			case 195: $function = 'DSTDEVP'; 		$args = 3;	break;
			case 196: $function = 'DVARP'; 			$args = 3;	break;
			case 198: $function = 'ISLOGICAL'; 		$args = 1;	break;
			case 199: $function = 'DCOUNTA'; 		$args = 3;	break;
			case 207: $function = 'REPLACEB'; 		$args = 4;	break;
			case 210: $function = 'MIDB'; 			$args = 3;	break;
			case 211: $function = 'LENB'; 			$args = 1;	break;
			case 212: $function = 'ROUNDUP'; 		$args = 2;	break;
			case 213: $function = 'ROUNDDOWN'; 		$args = 2;	break;
			case 214: $function = 'ASC'; 			$args = 1;	break;
			case 215: $function = 'DBCS'; 			$args = 1;	break;
			case 221: $function = 'TODAY'; 			$args = 0;	break;
			case 229: $function = 'SINH'; 			$args = 1;	break;
			case 230: $function = 'COSH'; 			$args = 1;	break;
			case 231: $function = 'TANH'; 			$args = 1;	break;
			case 232: $function = 'ASINH'; 			$args = 1;	break;
			case 233: $function = 'ACOSH'; 			$args = 1;	break;
			case 234: $function = 'ATANH'; 			$args = 1;	break;
			case 235: $function = 'DGET'; 			$args = 3;	break;
			case 244: $function = 'INFO'; 			$args = 1;	break;
			case 252: $function = 'FREQUENCY'; 		$args = 2;	break;
			case 261: $function = 'ERROR.TYPE'; 	$args = 1;	break;
			case 271: $function = 'GAMMALN'; 		$args = 1;	break;
			case 273: $function = 'BINOMDIST'; 		$args = 4;	break;
			case 274: $function = 'CHIDIST'; 		$args = 2;	break;
			case 275: $function = 'CHIINV'; 		$args = 2;	break;
			case 276: $function = 'COMBIN'; 		$args = 2;	break;
			case 277: $function = 'CONFIDENCE'; 	$args = 3;	break;
			case 278: $function = 'CRITBINOM'; 		$args = 3;	break;
			case 279: $function = 'EVEN'; 			$args = 1;	break;
			case 280: $function = 'EXPONDIST'; 		$args = 3;	break;
			case 281: $function = 'FDIST'; 			$args = 3;	break;
			case 282: $function = 'FINV'; 			$args = 3;	break;
			case 283: $function = 'FISHER'; 		$args = 1;	break;
			case 284: $function = 'FISHERINV'; 		$args = 1;	break;
			case 285: $function = 'FLOOR'; 			$args = 2;	break;
			case 286: $function = 'GAMMADIST'; 		$args = 4;	break;
			case 287: $function = 'GAMMAINV'; 		$args = 3;	break;
			case 288: $function = 'CEILING'; 		$args = 2;	break;
			case 289: $function = 'HYPGEOMDIST';	$args = 4;	break;
			case 290: $function = 'LOGNORMDIST';	$args = 3;	break;
			case 291: $function = 'LOGINV';			$args = 3;	break;
			case 292: $function = 'NEGBINOMDIST';	$args = 3;	break;
			case 293: $function = 'NORMDIST';		$args = 4;	break;
			case 294: $function = 'NORMSDIST';		$args = 1;	break;
			case 295: $function = 'NORMINV';		$args = 3;	break;
			case 296: $function = 'NORMSINV';		$args = 1;	break;
			case 297: $function = 'STANDARDIZE';	$args = 3;	break;
			case 298: $function = 'ODD';			$args = 1;	break;
			case 299: $function = 'PERMUT';			$args = 2;	break;
			case 300: $function = 'POISSON';		$args = 3;	break;
			case 301: $function = 'TDIST';			$args = 3;	break;
			case 302: $function = 'WEIBULL';		$args = 4;	break;
			case 303: $function = 'SUMXMY2';		$args = 2;	break;
			case 304: $function = 'SUMX2MY2';		$args = 2;	break;
			case 305: $function = 'SUMX2PY2';		$args = 2;	break;
			case 306: $function = 'CHITEST';		$args = 2;	break;
			case 307: $function = 'CORREL';			$args = 2;	break;
			case 308: $function = 'COVAR';			$args = 2;	break;
			case 309: $function = 'FORECAST';		$args = 3;	break;
			case 310: $function = 'FTEST';			$args = 2;	break;
			case 311: $function = 'INTERCEPT';		$args = 2;	break;
			case 312: $function = 'PEARSON';		$args = 2;	break;
			case 313: $function = 'RSQ';			$args = 2;	break;
			case 314: $function = 'STEYX';			$args = 2;	break;
			case 315: $function = 'SLOPE';			$args = 2;	break;
			case 316: $function = 'TTEST';			$args = 4;	break;
			case 325: $function = 'LARGE';			$args = 2;	break;
			case 326: $function = 'SMALL';			$args = 2;	break;
			case 327: $function = 'QUARTILE';		$args = 2;	break;
			case 328: $function = 'PERCENTILE';		$args = 2;	break;
			case 331: $function = 'TRIMMEAN';		$args = 2;	break;
			case 332: $function = 'TINV';			$args = 2;	break;
			case 337: $function = 'POWER';			$args = 2;	break;
			case 342: $function = 'RADIANS';		$args = 1;	break;
			case 343: $function = 'DEGREES';		$args = 1;	break;
			case 346: $function = 'COUNTIF';		$args = 2;	break;
			case 347: $function = 'COUNTBLANK';		$args = 1;	break;
			case 350: $function = 'ISPMT';			$args = 4;	break;
			case 351: $function = 'DATEDIF';		$args = 3;	break;
			case 352: $function = 'DATESTRING';		$args = 1;	break;
			case 353: $function = 'NUMBERSTRING';	$args = 2;	break;
			case 360: $function = 'PHONETIC';		$args = 1;	break;
			case 368: $function = 'BAHTTEXT';		$args = 1;	break;
			default:
				throw new PHPExcel_Reader_Exception('Unrecognized function in formula');
				break;
			}
			$data = array('function' => $function, 'args' => $args);
			break;
		case 0x22:	//	function with variable number of arguments
		case 0x42:
		case 0x62:
			$name = 'tFuncV';
			$size = 4;
			// offset: 1; size: 1; number of arguments
			$args = ord($formulaData[1]);
			// offset: 2: size: 2; index to built-in sheet function
			$index = self::_GetInt2d($formulaData, 2);
			switch ($index) {
			case   0: $function = 'COUNT';			break;
			case   1: $function = 'IF';				break;
			case   4: $function = 'SUM';			break;
			case   5: $function = 'AVERAGE';		break;
			case   6: $function = 'MIN';			break;
			case   7: $function = 'MAX';			break;
			case   8: $function = 'ROW';			break;
			case   9: $function = 'COLUMN';			break;
			case  11: $function = 'NPV';			break;
			case  12: $function = 'STDEV';			break;
			case  13: $function = 'DOLLAR';			break;
			case  14: $function = 'FIXED';			break;
			case  28: $function = 'LOOKUP';			break;
			case  29: $function = 'INDEX';			break;
			case  36: $function = 'AND';			break;
			case  37: $function = 'OR';				break;
			case  46: $function = 'VAR';			break;
			case  49: $function = 'LINEST';			break;
			case  50: $function = 'TREND';			break;
			case  51: $function = 'LOGEST';			break;
			case  52: $function = 'GROWTH';			break;
			case  56: $function = 'PV';				break;
			case  57: $function = 'FV';				break;
			case  58: $function = 'NPER';			break;
			case  59: $function = 'PMT';			break;
			case  60: $function = 'RATE';			break;
			case  62: $function = 'IRR';			break;
			case  64: $function = 'MATCH';			break;
			case  70: $function = 'WEEKDAY';		break;
			case  78: $function = 'OFFSET';			break;
			case  82: $function = 'SEARCH';			break;
			case 100: $function = 'CHOOSE';			break;
			case 101: $function = 'HLOOKUP';		break;
			case 102: $function = 'VLOOKUP';		break;
			case 109: $function = 'LOG';			break;
			case 115: $function = 'LEFT';			break;
			case 116: $function = 'RIGHT';			break;
			case 120: $function = 'SUBSTITUTE';		break;
			case 124: $function = 'FIND';			break;
			case 125: $function = 'CELL';			break;
			case 144: $function = 'DDB';			break;
			case 148: $function = 'INDIRECT';		break;
			case 167: $function = 'IPMT';			break;
			case 168: $function = 'PPMT';			break;
			case 169: $function = 'COUNTA';			break;
			case 183: $function = 'PRODUCT';		break;
			case 193: $function = 'STDEVP';			break;
			case 194: $function = 'VARP';			break;
			case 197: $function = 'TRUNC';			break;
			case 204: $function = 'USDOLLAR';		break;
			case 205: $function = 'FINDB';			break;
			case 206: $function = 'SEARCHB';		break;
			case 208: $function = 'LEFTB';			break;
			case 209: $function = 'RIGHTB';			break;
			case 216: $function = 'RANK';			break;
			case 219: $function = 'ADDRESS';		break;
			case 220: $function = 'DAYS360';		break;
			case 222: $function = 'VDB';			break;
			case 227: $function = 'MEDIAN';			break;
			case 228: $function = 'SUMPRODUCT';		break;
			case 247: $function = 'DB';				break;
			case 255: $function = '';				break;
			case 269: $function = 'AVEDEV';			break;
			case 270: $function = 'BETADIST';		break;
			case 272: $function = 'BETAINV';		break;
			case 317: $function = 'PROB';			break;
			case 318: $function = 'DEVSQ';			break;
			case 319: $function = 'GEOMEAN';		break;
			case 320: $function = 'HARMEAN';		break;
			case 321: $function = 'SUMSQ';			break;
			case 322: $function = 'KURT';			break;
			case 323: $function = 'SKEW';			break;
			case 324: $function = 'ZTEST';			break;
			case 329: $function = 'PERCENTRANK';	break;
			case 330: $function = 'MODE';			break;
			case 336: $function = 'CONCATENATE';	break;
			case 344: $function = 'SUBTOTAL';		break;
			case 345: $function = 'SUMIF';			break;
			case 354: $function = 'ROMAN';			break;
			case 358: $function = 'GETPIVOTDATA';	break;
			case 359: $function = 'HYPERLINK';		break;
			case 361: $function = 'AVERAGEA';		break;
			case 362: $function = 'MAXA';			break;
			case 363: $function = 'MINA';			break;
			case 364: $function = 'STDEVPA';		break;
			case 365: $function = 'VARPA';			break;
			case 366: $function = 'STDEVA';			break;
			case 367: $function = 'VARA';			break;
			default:
				throw new PHPExcel_Reader_Exception('Unrecognized function in formula');
				break;
			}
			$data = array('function' => $function, 'args' => $args);
			break;
		case 0x23:	//	index to defined name
		case 0x43:
		case 0x63:
			$name = 'tName';
			$size = 5;
			// offset: 1; size: 2; one-based index to definedname record
			$definedNameIndex = self::_GetInt2d($formulaData, 1) - 1;
			// offset: 2; size: 2; not used
			$data = $this->_definedname[$definedNameIndex]['name'];
			break;
		case 0x24:	//	single cell reference e.g. A5
		case 0x44:
		case 0x64:
			$name = 'tRef';
			$size = 5;
			$data = $this->_readBIFF8CellAddress(substr($formulaData, 1, 4));
			break;
		case 0x25:	//	cell range reference to cells in the same sheet (2d)
		case 0x45:
		case 0x65:
			$name = 'tArea';
			$size = 9;
			$data = $this->_readBIFF8CellRangeAddress(substr($formulaData, 1, 8));
			break;
		case 0x26:	//	Constant reference sub-expression
		case 0x46:
		case 0x66:
			$name = 'tMemArea';
			// offset: 1; size: 4; not used
			// offset: 5; size: 2; size of the following subexpression
			$subSize = self::_GetInt2d($formulaData, 5);
			$size = 7 + $subSize;
			$data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize));
			break;
		case 0x27:	//	Deleted constant reference sub-expression
		case 0x47:
		case 0x67:
			$name = 'tMemErr';
			// offset: 1; size: 4; not used
			// offset: 5; size: 2; size of the following subexpression
			$subSize = self::_GetInt2d($formulaData, 5);
			$size = 7 + $subSize;
			$data = $this->_getFormulaFromData(substr($formulaData, 7, $subSize));
			break;
		case 0x29:	//	Variable reference sub-expression
		case 0x49:
		case 0x69:
			$name = 'tMemFunc';
			// offset: 1; size: 2; size of the following sub-expression
			$subSize = self::_GetInt2d($formulaData, 1);
			$size = 3 + $subSize;
			$data = $this->_getFormulaFromData(substr($formulaData, 3, $subSize));
			break;

		case 0x2C: // Relative 2d cell reference reference, used in shared formulas and some other places
		case 0x4C:
		case 0x6C:
			$name = 'tRefN';
			$size = 5;
			$data = $this->_readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell);
			break;

		case 0x2D:	//	Relative 2d range reference
		case 0x4D:
		case 0x6D:
			$name = 'tAreaN';
			$size = 9;
			$data = $this->_readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell);
			break;

		case 0x39:	//	External name
		case 0x59:
		case 0x79:
			$name = 'tNameX';
			$size = 7;
			// offset: 1; size: 2; index to REF entry in EXTERNSHEET record
			// offset: 3; size: 2; one-based index to DEFINEDNAME or EXTERNNAME record
			$index = self::_GetInt2d($formulaData, 3);
			// assume index is to EXTERNNAME record
			$data = $this->_externalNames[$index - 1]['name'];
			// offset: 5; size: 2; not used
			break;

		case 0x3A:	//	3d reference to cell
		case 0x5A:
		case 0x7A:
			$name = 'tRef3d';
			$size = 7;

			try {
				// offset: 1; size: 2; index to REF entry
				$sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1));
				// offset: 3; size: 4; cell address
				$cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4));

				$data = "$sheetRange!$cellAddress";
			} catch (PHPExcel_Exception $e) {
				// deleted sheet reference
				$data = '#REF!';
			}

			break;
		case 0x3B:	//	3d reference to cell range
		case 0x5B:
		case 0x7B:
			$name = 'tArea3d';
			$size = 11;

			try {
				// offset: 1; size: 2; index to REF entry
				$sheetRange = $this->_readSheetRangeByRefIndex(self::_GetInt2d($formulaData, 1));
				// offset: 3; size: 8; cell address
				$cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8));

				$data = "$sheetRange!$cellRangeAddress";
			} catch (PHPExcel_Exception $e) {
				// deleted sheet reference
				$data = '#REF!';
			}

			break;
		// Unknown cases	// don't know how to deal with
		default:
			throw new PHPExcel_Reader_Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula');
			break;
		}

		return array(
			'id' => $id,
			'name' => $name,
			'size' => $size,
			'data' => $data,
		);
	}
609284
private function _readRow()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if (!$this->_readDataOnly) {
			// offset: 0; size: 2; index of this row
			$r = self::_GetInt2d($recordData, 0);

			// offset: 2; size: 2; index to column of the first cell which is described by a cell record

			// offset: 4; size: 2; index to column of the last cell which is described by a cell record, increased by 1

			// offset: 6; size: 2;

			// bit: 14-0; mask: 0x7FFF; height of the row, in twips = 1/20 of a point
			$height = (0x7FFF & self::_GetInt2d($recordData, 6)) >> 0;

			// bit: 15: mask: 0x8000; 0 = row has custom height; 1= row has default height
			$useDefaultHeight = (0x8000 & self::_GetInt2d($recordData, 6)) >> 15;

			if (!$useDefaultHeight) {
				$this->_phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20);
			}

			// offset: 8; size: 2; not used

			// offset: 10; size: 2; not used in BIFF5-BIFF8

			// offset: 12; size: 4; option flags and default row formatting

			// bit: 2-0: mask: 0x00000007; outline level of the row
			$level = (0x00000007 & self::_GetInt4d($recordData, 12)) >> 0;
			$this->_phpSheet->getRowDimension($r + 1)->setOutlineLevel($level);

			// bit: 4; mask: 0x00000010; 1 = outline group start or ends here... and is collapsed
			$isCollapsed = (0x00000010 & self::_GetInt4d($recordData, 12)) >> 4;
			$this->_phpSheet->getRowDimension($r + 1)->setCollapsed($isCollapsed);

			// bit: 5; mask: 0x00000020; 1 = row is hidden
			$isHidden = (0x00000020 & self::_GetInt4d($recordData, 12)) >> 5;
			$this->_phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden);

			// bit: 7; mask: 0x00000080; 1 = row has explicit format
			$hasExplicitFormat = (0x00000080 & self::_GetInt4d($recordData, 12)) >> 7;

			// bit: 27-16; mask: 0x0FFF0000; only applies when hasExplicitFormat = 1; index to XF record
			$xfIndex = (0x0FFF0000 & self::_GetInt4d($recordData, 12)) >> 16;

			if ($hasExplicitFormat) {
				$this->_phpSheet->getRowDimension($r + 1)->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
			}
		}
	}
565014
protected static double[] sub(double[] base, double subNumber)
    {
        int dataNum = base.length;
        double[] result = new double[dataNum];

        for (int index = 0; index < dataNum; index++)
        {
            result[index] = base[index] / subNumber;
        }

        return result;
    }
1172876
public function getCell($pCoordinate = 'A1')
    {
        // Check cell collection
        if ($this->cellCollection->isDataSet(strtoupper($pCoordinate))) {
            return $this->cellCollection->getCacheData($pCoordinate);
        }

        // Worksheet reference?
        if (strpos($pCoordinate, '!') !== false) {
            $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
            return $this->parent->getSheetByName($worksheetReference[0])->getCell(strtoupper($worksheetReference[1]));
        }

        // Named range?
        if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
            (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
            $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
            if ($namedRange !== null) {
                $pCoordinate = $namedRange->getRange();
                return $namedRange->getWorksheet()->getCell($pCoordinate);
            }
        }

        // Uppercase coordinate
        $pCoordinate = strtoupper($pCoordinate);

        if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
            throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
        } elseif (strpos($pCoordinate, '$') !== false) {
            throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
        }

        // Create new cell object
        return $this->createNewCell($pCoordinate);
    }
180576
protected function _getBaseStringFromDate(array $data, array $baseField) {
        $col = $baseField['column'];
        $format = $baseField['format'] ?: 'd-m-Y';
        if (!array_key_exists($col, $data)) {
            return '';
        }
        return date($format, strtotime($data[$col]));
    }
1182905
private static function readUnicodeStringShort($subData)
    {
        $value = '';

        // offset: 0: size: 1; length of the string (character count)
        $characterCount = ord($subData[0]);

        $string = self::readUnicodeString(substr($subData, 1), $characterCount);

        // add 1 for the string length
        $string['size'] += 1;

        return $string;
    }