You are here

private function PHPExcel_Reader_Excel5::_readBoolErr 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::_readBoolErr()

* Read BOOLERR record * This record represents a Boolean value or error value * cell. * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format"

1 call to PHPExcel_Reader_Excel5::_readBoolErr()
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 3993

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private function _readBoolErr() {
  $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;

  // 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 ($this
    ->getReadFilter() !== NULL && $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]);
    }
  }
}