You are here

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

* Read WINDOW2 record

1 call to PHPExcel_Reader_Excel5::_readWindow2()
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 4229

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private function _readWindow2() {
  $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; option flags
  $options = self::_GetInt2d($recordData, 0);

  // offset: 2; size: 2; index to first visible row
  $firstVisibleRow = self::_GetInt2d($recordData, 2);

  // offset: 4; size: 2; index to first visible colum
  $firstVisibleColumn = self::_GetInt2d($recordData, 4);
  if ($this->_version === self::XLS_BIFF8) {

    // offset:  8; size: 2; not used
    // offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%)
    // offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%)
    // offset: 14; size: 4; not used
    $zoomscaleInPageBreakPreview = self::_GetInt2d($recordData, 10);
    if ($zoomscaleInPageBreakPreview === 0) {
      $zoomscaleInPageBreakPreview = 60;
    }
    $zoomscaleInNormalView = self::_GetInt2d($recordData, 12);
    if ($zoomscaleInNormalView === 0) {
      $zoomscaleInNormalView = 100;
    }
  }

  // bit: 1; mask: 0x0002; 0 = do not show gridlines, 1 = show gridlines
  $showGridlines = (bool) ((0x2 & $options) >> 1);
  $this->_phpSheet
    ->setShowGridlines($showGridlines);

  // bit: 2; mask: 0x0004; 0 = do not show headers, 1 = show headers
  $showRowColHeaders = (bool) ((0x4 & $options) >> 2);
  $this->_phpSheet
    ->setShowRowColHeaders($showRowColHeaders);

  // bit: 3; mask: 0x0008; 0 = panes are not frozen, 1 = panes are frozen
  $this->_frozen = (bool) ((0x8 & $options) >> 3);

  // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left
  $this->_phpSheet
    ->setRightToLeft((bool) ((0x40 & $options) >> 6));

  // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active
  $isActive = (bool) ((0x400 & $options) >> 10);
  if ($isActive) {
    $this->_phpExcel
      ->setActiveSheetIndex($this->_phpExcel
      ->getIndex($this->_phpSheet));
  }

  // bit: 11; mask: 0x0800; 0 = normal view, 1 = page break view
  $isPageBreakPreview = (bool) ((0x800 & $options) >> 11);

  //FIXME: set $firstVisibleRow and $firstVisibleColumn
  if ($this->_phpSheet
    ->getSheetView()
    ->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) {

    //NOTE: this setting is inferior to page layout view(Excel2007-)
    $view = $isPageBreakPreview ? PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL;
    $this->_phpSheet
      ->getSheetView()
      ->setView($view);
    if ($this->_version === self::XLS_BIFF8) {
      $zoomScale = $isPageBreakPreview ? $zoomscaleInPageBreakPreview : $zoomscaleInNormalView;
      $this->_phpSheet
        ->getSheetView()
        ->setZoomScale($zoomScale);
      $this->_phpSheet
        ->getSheetView()
        ->setZoomScaleNormal($zoomscaleInNormalView);
    }
  }
}