private function PHPExcel_Reader_Excel5::_readDefinedName in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readDefinedName()
* DEFINEDNAME * * This record is part of a Link Table. It contains the name * and the token array of an internal defined name. Token * arrays of defined names contain tokens with aberrant * token classes. * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format"
1 call to PHPExcel_Reader_Excel5::_readDefinedName()
- PHPExcel_Reader_Excel5::load in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php - * Loads PHPExcel from file * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php, line 2725
Class
- PHPExcel_Reader_Excel5
- PHPExcel_Reader_Excel5
Code
private function _readDefinedName() {
$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->_version == self::XLS_BIFF8) {
// retrieves named cells
// offset: 0; size: 2; option flags
$opts = self::_GetInt2d($recordData, 0);
// bit: 5; mask: 0x0020; 0 = user-defined name, 1 = built-in-name
$isBuiltInName = (0x20 & $opts) >> 5;
// offset: 2; size: 1; keyboard shortcut
// offset: 3; size: 1; length of the name (character count)
$nlen = ord($recordData[3]);
// offset: 4; size: 2; size of the formula data (it can happen that this is zero)
// note: there can also be additional data, this is not included in $flen
$flen = self::_GetInt2d($recordData, 4);
// offset: 8; size: 2; 0=Global name, otherwise index to sheet (1-based)
$scope = self::_GetInt2d($recordData, 8);
// offset: 14; size: var; Name (Unicode string without length field)
$string = self::_readUnicodeString(substr($recordData, 14), $nlen);
// offset: var; size: $flen; formula data
$offset = 14 + $string['size'];
$formulaStructure = pack('v', $flen) . substr($recordData, $offset);
try {
$formula = $this
->_getFormulaFromStructure($formulaStructure);
} catch (PHPExcel_Exception $e) {
$formula = '';
}
$this->_definedname[] = array(
'isBuiltInName' => $isBuiltInName,
'name' => $string['value'],
'formula' => $formula,
'scope' => $scope,
);
}
}