You are here

private function PHPExcel_Reader_Excel5::_readBIFF8CellAddressB in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readBIFF8CellAddressB()

* Reads a cell 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 * *

Parameters

string $cellAddressStructure: * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return string

1 call to PHPExcel_Reader_Excel5::_readBIFF8CellAddressB()
PHPExcel_Reader_Excel5::_getNextToken in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Fetch next token from binary formula data * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php, line 6044

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private function _readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') {
  list($baseCol, $baseRow) = PHPExcel_Cell::coordinateFromString($baseCell);
  $baseCol = PHPExcel_Cell::columnIndexFromString($baseCol) - 1;

  // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767))
  $rowIndex = self::_GetInt2d($cellAddressStructure, 0);
  $row = self::_GetInt2d($cellAddressStructure, 0) + 1;

  // offset: 2; size: 2; index to column or column offset + relative flags
  // bit: 7-0; mask 0x00FF; column index
  $colIndex = 0xff & self::_GetInt2d($cellAddressStructure, 2);

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

  // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
  if (!(0x8000 & self::_GetInt2d($cellAddressStructure, 2))) {
    $row = '$' . $row;
  }
  else {
    $rowIndex = $rowIndex <= 32767 ? $rowIndex : $rowIndex - 65536;
    $row = $baseRow + $rowIndex;
  }
  return $column . $row;
}