Example #1
0
	 * This record represents a cell that contains a string. It
	 * replaces the LABEL record and RSTRING record used in
	 * BIFF2-BIFF5.
	 *
	 * --	"OpenOffice.org's Documentation of the Microsoft
	 * 		Excel File Format"
	 */
    private function _readLabelSst()
    {
        $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; index to XF record
            $xfIndex = self::_GetInt2d($recordData, 4);
            // offset: 6; size: 4; index to SST record
            $index = self::_GetInt4d($recordData, 6);
            // add cell
Example #2
0
 /**
  * Read WINDOW2 record
  */
 private function _readWindow2()
 {
     $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; 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);
         }
     }
 }