You are here

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

* Read additional document summary information

1 call to PHPExcel_Reader_Excel5::_readDocumentSummaryInformation()
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 1343

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private function _readDocumentSummaryInformation() {
  if (!isset($this->_documentSummaryInformation)) {
    return;
  }

  //	offset: 0;	size: 2;	must be 0xFE 0xFF (UTF-16 LE byte order mark)
  //	offset: 2;	size: 2;
  //	offset: 4;	size: 2;	OS version
  //	offset: 6;	size: 2;	OS indicator
  //	offset: 8;	size: 16
  //	offset: 24;	size: 4;	section count
  $secCount = self::_GetInt4d($this->_documentSummaryInformation, 24);

  //		echo '$secCount = ',$secCount,'<br />';
  // offset: 28;	size: 16;	first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
  // offset: 44;	size: 4;	first section offset
  $secOffset = self::_GetInt4d($this->_documentSummaryInformation, 44);

  //		echo '$secOffset = ',$secOffset,'<br />';
  //	section header
  //	offset: $secOffset;	size: 4;	section length
  $secLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset);

  //		echo '$secLength = ',$secLength,'<br />';
  //	offset: $secOffset+4;	size: 4;	property count
  $countProperties = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4);

  //		echo '$countProperties = ',$countProperties,'<br />';
  // initialize code page (used to resolve string values)
  $codePage = 'CP1252';

  //	offset: ($secOffset+8);	size: var
  //	loop through property decarations and properties
  for ($i = 0; $i < $countProperties; ++$i) {

    //			echo 'Property ',$i,'<br />';
    //	offset: ($secOffset+8) + (8 * $i);	size: 4;	property ID
    $id = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 8 + 8 * $i);

    //			echo 'ID is ',$id,'<br />';
    // Use value of property id as appropriate
    // offset: 60 + 8 * $i;	size: 4;	offset from beginning of section (48)
    $offset = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 12 + 8 * $i);
    $type = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + $offset);

    //			echo 'Type is ',$type,', ';
    // initialize property value
    $value = null;

    // extract property value based on property type
    switch ($type) {
      case 0x2:

        //	2 byte signed integer
        $value = self::_GetInt2d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
        break;
      case 0x3:

        //	4 byte signed integer
        $value = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
        break;
      case 0xb:

        // Boolean
        $value = self::_GetInt2d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
        $value = $value == 0 ? false : true;
        break;
      case 0x13:

        //	4 byte unsigned integer
        // not needed yet, fix later if necessary
        break;
      case 0x1e:

        //	null-terminated string prepended by dword string length
        $byteLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
        $value = substr($this->_documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
        $value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage);
        $value = rtrim($value);
        break;
      case 0x40:

        //	Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
        // PHP-Time
        $value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->_documentSummaryInformation, $secOffset + 4 + $offset, 8));
        break;
      case 0x47:

        //	Clipboard format
        // not needed yet, fix later if necessary
        break;
    }
    switch ($id) {
      case 0x1:

        //	Code Page
        $codePage = PHPExcel_Shared_CodePage::NumberToName($value);
        break;
      case 0x2:

        //	Category
        $this->_phpExcel
          ->getProperties()
          ->setCategory($value);
        break;
      case 0x3:

        //	Presentation Target
        //	Not supported by PHPExcel
        break;
      case 0x4:

        //	Bytes
        //	Not supported by PHPExcel
        break;
      case 0x5:

        //	Lines
        //	Not supported by PHPExcel
        break;
      case 0x6:

        //	Paragraphs
        //	Not supported by PHPExcel
        break;
      case 0x7:

        //	Slides
        //	Not supported by PHPExcel
        break;
      case 0x8:

        //	Notes
        //	Not supported by PHPExcel
        break;
      case 0x9:

        //	Hidden Slides
        //	Not supported by PHPExcel
        break;
      case 0xa:

        //	MM Clips
        //	Not supported by PHPExcel
        break;
      case 0xb:

        //	Scale Crop
        //	Not supported by PHPExcel
        break;
      case 0xc:

        //	Heading Pairs
        //	Not supported by PHPExcel
        break;
      case 0xd:

        //	Titles of Parts
        //	Not supported by PHPExcel
        break;
      case 0xe:

        //	Manager
        $this->_phpExcel
          ->getProperties()
          ->setManager($value);
        break;
      case 0xf:

        //	Company
        $this->_phpExcel
          ->getProperties()
          ->setCompany($value);
        break;
      case 0x10:

        //	Links up-to-date
        //	Not supported by PHPExcel
        break;
    }
  }
}