{ $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = substr($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; if ($this->_version == self::XLS_BIFF8) { $string = self::_readUnicodeStringLong($recordData); $value = $string['value']; } else { $string = $this->_readByteStringLong($recordData); $value = $string['value']; } return $value; } /** * Read BOOLERR record * This record represents a Boolean value or error value * cell. * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ private function _readBoolErr() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = substr($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; column index $column = self::_GetInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? if (!is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { // offset: 4; size: 2; index to XF record $xfIndex = self::_GetInt2d($recordData, 4); // offset: 6; size: 1; the boolean value or error value $boolErr = ord($recordData[6]); // offset: 7; size: 1; 0=boolean; 1=error $isError = ord($recordData[7]); $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); switch ($isError) { case 0: // boolean $value = (bool) $boolErr; // add cell value $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_BOOL); break; case 1: // error type $value = self::_mapErrorCode($boolErr); // add cell value $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_ERROR); break; } if (!$this->_readDataOnly) { // add cell style $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } } } /** * Read MULBLANK record * This record represents a cell range of empty cells. All * cells are located in the same row * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ private function _readMulBlank() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = substr($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // offset: 0; size: 2; index to row $row = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; index to first column $fc = self::_GetInt2d($recordData, 2); // offset: 4; size: 2 x nc; list of indexes to XF records // add style information if (!$this->_readDataOnly) { for ($i = 0; $i < $length / 2 - 3; ++$i) { $columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i); // Read cell? if (!is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { $xfIndex = self::_GetInt2d($recordData, 4 + 2 * $i); $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } } } // offset: 6; size 2; index to last column (not needed) } /** * Read LABEL record * This record represents a cell that contains a string. In * BIFF8 it is usually replaced by the LABELSST record. * Excel still uses this record, if it copies unformatted * text cells to the clipboard. * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" */ private function _readLabel() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = substr($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; // offset: 0; size: 2; index to row $row = self::_GetInt2d($recordData, 0); // offset: 2; size: 2; index to column $column = self::_GetInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($column); // Read cell? if (!is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { // offset: 4; size: 2; XF index $xfIndex = self::_GetInt2d($recordData, 4); // add cell value // todo: what if string is very long? continue record if ($this->_version == self::XLS_BIFF8) { $string = self::_readUnicodeStringLong(substr($recordData, 6)); $value = $string['value']; } else { $string = $this->_readByteStringLong(substr($recordData, 6)); $value = $string['value']; } $cell = $this->_phpSheet->getCell($columnString . ($row + 1)); $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); if (!$this->_readDataOnly) { // add cell style $cell->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } } } /** * Read BLANK record */ private function _readBlank() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); $recordData = substr($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 $col = self::_GetInt2d($recordData, 2); $columnString = PHPExcel_Cell::stringFromColumnIndex($col); // Read cell? if (!is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) { // offset: 4; size: 2; XF index $xfIndex = self::_GetInt2d($recordData, 4); // add style information if (!$this->_readDataOnly) { $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]); } } } /** * Read MSODRAWING record */ private function _readMsoDrawing() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); // get spliced record data