You are here

private function PHPExcel_Reader_Excel5::_readExternalBook in Loft Data Grids 7.2

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

* Read EXTERNALBOOK record

1 call to PHPExcel_Reader_Excel5::_readExternalBook()
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 2589

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private function _readExternalBook() {
  $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 within record data
  $offset = 0;

  // there are 4 types of records
  if (strlen($recordData) > 4) {

    // external reference
    // offset: 0; size: 2; number of sheet names ($nm)
    $nm = self::_GetInt2d($recordData, 0);
    $offset += 2;

    // offset: 2; size: var; encoded URL without sheet name (Unicode string, 16-bit length)
    $encodedUrlString = self::_readUnicodeStringLong(substr($recordData, 2));
    $offset += $encodedUrlString['size'];

    // offset: var; size: var; list of $nm sheet names (Unicode strings, 16-bit length)
    $externalSheetNames = array();
    for ($i = 0; $i < $nm; ++$i) {
      $externalSheetNameString = self::_readUnicodeStringLong(substr($recordData, $offset));
      $externalSheetNames[] = $externalSheetNameString['value'];
      $offset += $externalSheetNameString['size'];
    }

    // store the record data
    $this->_externalBooks[] = array(
      'type' => 'external',
      'encodedUrl' => $encodedUrlString['value'],
      'externalSheetNames' => $externalSheetNames,
    );
  }
  elseif (substr($recordData, 2, 2) == pack('CC', 0x1, 0x4)) {

    // internal reference
    // offset: 0; size: 2; number of sheet in this document
    // offset: 2; size: 2; 0x01 0x04
    $this->_externalBooks[] = array(
      'type' => 'internal',
    );
  }
  elseif (substr($recordData, 0, 4) == pack('vCC', 0x1, 0x1, 0x3a)) {

    // add-in function
    // offset: 0; size: 2; 0x0001
    $this->_externalBooks[] = array(
      'type' => 'addInFunction',
    );
  }
  elseif (substr($recordData, 0, 2) == pack('v', 0x0)) {

    // DDE links, OLE links
    // offset: 0; size: 2; 0x0000
    // offset: 2; size: var; encoded source document name
    $this->_externalBooks[] = array(
      'type' => 'DDEorOLE',
    );
  }
}