private function PHPExcel_Reader_Excel5::_readBIFF8CellRangeAddressB in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readBIFF8CellRangeAddressB()
* 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 * *
Parameters
string $subData: * @param string $baseCell Base cell * @return string Cell range address
1 call to PHPExcel_Reader_Excel5::_readBIFF8CellRangeAddressB()
- 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 6219
Class
- PHPExcel_Reader_Excel5
- PHPExcel_Reader_Excel5
Code
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 = 0xff & 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 = 0xff & 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}";
}