You are here

private function PHPExcel_Reader_Excel5::_readBIFF8CellRangeAddress in Loft Data Grids 6.2

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

* Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6' * there are flags indicating whether column/row index is relative * section 3.3.4 * *

Parameters

string $subData: * @return string

1 call to PHPExcel_Reader_Excel5::_readBIFF8CellRangeAddress()
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 6165

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private function _readBIFF8CellRangeAddress($subData) {

  // 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; index to first row (0... 65535) (or offset (-32768... 32767))
  $fr = self::_GetInt2d($subData, 0) + 1;

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

  // offset: 4; size: 2; index to first column or column offset + relative flags
  // bit: 7-0; mask 0x00FF; column index
  $fc = PHPExcel_Cell::stringFromColumnIndex(0xff & self::_GetInt2d($subData, 4));

  // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
  if (!(0x4000 & self::_GetInt2d($subData, 4))) {
    $fc = '$' . $fc;
  }

  // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
  if (!(0x8000 & self::_GetInt2d($subData, 4))) {
    $fr = '$' . $fr;
  }

  // offset: 6; size: 2; index to last column or column offset + relative flags
  // bit: 7-0; mask 0x00FF; column index
  $lc = PHPExcel_Cell::stringFromColumnIndex(0xff & self::_GetInt2d($subData, 6));

  // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index)
  if (!(0x4000 & self::_GetInt2d($subData, 6))) {
    $lc = '$' . $lc;
  }

  // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index)
  if (!(0x8000 & self::_GetInt2d($subData, 6))) {
    $lr = '$' . $lr;
  }
  return "{$fc}{$fr}:{$lc}{$lr}";
}