mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-29 08:46:03 +03:00
commit
d41a1f5952
@ -156,6 +156,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
const XLS_Type_RANGEPROTECTION = 0x0868;
|
||||
const XLS_Type_SHEETLAYOUT = 0x0862;
|
||||
const XLS_Type_XFEXT = 0x087d;
|
||||
const XLS_Type_PAGELAYOUTVIEW = 0x088b;
|
||||
const XLS_Type_UNKNOWN = 0xffff;
|
||||
|
||||
|
||||
@ -784,6 +785,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
case self::XLS_Type_MSODRAWING: $this->_readMsoDrawing(); break;
|
||||
case self::XLS_Type_OBJ: $this->_readObj(); break;
|
||||
case self::XLS_Type_WINDOW2: $this->_readWindow2(); break;
|
||||
case self::XLS_Type_PAGELAYOUTVIEW: $this->_readPageLayoutView(); break;
|
||||
case self::XLS_Type_SCL: $this->_readScl(); break;
|
||||
case self::XLS_Type_PANE: $this->_readPane(); break;
|
||||
case self::XLS_Type_SELECTION: $this->_readSelection(); break;
|
||||
@ -3993,6 +3995,22 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
// 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) ((0x0002 & $options) >> 1);
|
||||
$this->_phpSheet->setShowGridlines($showGridlines);
|
||||
@ -4012,8 +4030,62 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
||||
if ($isActive) {
|
||||
$this->_phpExcel->setActiveSheetIndex($this->_phpExcel->getIndex($this->_phpSheet));
|
||||
}
|
||||
|
||||
// bit: 11; mask: 0x0800; 0 = normal view, 1 = page break view
|
||||
$isPageBreakPreview = (bool) ((0x0800 & $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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read PLV Record(Created by Excel2007 or upper)
|
||||
*/
|
||||
private function _readPageLayoutView(){
|
||||
$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;
|
||||
|
||||
//var_dump(unpack("vrt/vgrbitFrt/V2reserved/vwScalePLV/vgrbit", $recordData));
|
||||
|
||||
// offset: 0; size: 2; rt
|
||||
//->ignore
|
||||
$rt = self::_GetInt2d($recordData, 0);
|
||||
// offset: 2; size: 2; grbitfr
|
||||
//->ignore
|
||||
$grbitFrt = self::_GetInt2d($recordData, 2);
|
||||
// offset: 4; size: 8; reserved
|
||||
//->ignore
|
||||
|
||||
// offset: 12; size 2; zoom scale
|
||||
$wScalePLV = self::_GetInt2d($recordData, 12);
|
||||
// offset: 14; size 2; grbit
|
||||
$grbit = self::_GetInt2d($recordData, 14);
|
||||
|
||||
// decomprise grbit
|
||||
$fPageLayoutView = $grbit & 0x01;
|
||||
$fRulerVisible = ($grbit >> 1) & 0x01; //no support
|
||||
$fWhitespaceHidden = ($grbit >> 3) & 0x01; //no support
|
||||
|
||||
if ($fPageLayoutView === 1) {
|
||||
$this->_phpSheet->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT);
|
||||
$this->_phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT
|
||||
}
|
||||
//otherwise, we cannot know whether SHEETVIEW_PAGE_LAYOUT or SHEETVIEW_PAGE_BREAK_PREVIEW.
|
||||
}
|
||||
|
||||
/**
|
||||
* Read SCL record
|
||||
|
@ -1278,6 +1278,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
// no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
|
||||
$fSelected = ($this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet()) ? 1 : 0;
|
||||
$fPaged = 1; // 2
|
||||
$fPageBreakPreview = $this->_phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
|
||||
|
||||
$grbit = $fDspFmla;
|
||||
$grbit |= $fDspGrid << 1;
|
||||
@ -1290,14 +1291,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
||||
$grbit |= $fFrozenNoSplit << 8;
|
||||
$grbit |= $fSelected << 9;
|
||||
$grbit |= $fPaged << 10;
|
||||
$grbit |= $fPageBreakPreview << 11;
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvv", $grbit, $rwTop, $colLeft);
|
||||
|
||||
// FIXME !!!
|
||||
$rgbHdr = 0x0040; // Row/column heading and gridline color index
|
||||
$zoom_factor_page_break = 0x0000;
|
||||
$zoom_factor_normal = 0x0000;
|
||||
$zoom_factor_page_break = ($fPageBreakPreview? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000);
|
||||
$zoom_factor_normal = $this->_phpSheet->getSheetView()->getZoomScaleNormal();
|
||||
|
||||
$data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
|
||||
|
||||
$this->_append($header.$data);
|
||||
|
Loading…
Reference in New Issue
Block a user