private function PHPExcel_Reader_Excel5::_readPageSetup in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readPageSetup()
* Read PAGESETUP record
1 call to PHPExcel_Reader_Excel5::_readPageSetup()
- 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 3275
Class
- PHPExcel_Reader_Excel5
- PHPExcel_Reader_Excel5
Code
private function _readPageSetup() {
$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;
if (!$this->_readDataOnly) {
// offset: 0; size: 2; paper size
$paperSize = self::_GetInt2d($recordData, 0);
// offset: 2; size: 2; scaling factor
$scale = self::_GetInt2d($recordData, 2);
// offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed
$fitToWidth = self::_GetInt2d($recordData, 6);
// offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed
$fitToHeight = self::_GetInt2d($recordData, 8);
// offset: 10; size: 2; option flags
// bit: 1; mask: 0x0002; 0=landscape, 1=portrait
$isPortrait = (0x2 & self::_GetInt2d($recordData, 10)) >> 1;
// bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init
// when this bit is set, do not use flags for those properties
$isNotInit = (0x4 & self::_GetInt2d($recordData, 10)) >> 2;
if (!$isNotInit) {
$this->_phpSheet
->getPageSetup()
->setPaperSize($paperSize);
switch ($isPortrait) {
case 0:
$this->_phpSheet
->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
break;
case 1:
$this->_phpSheet
->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
break;
}
$this->_phpSheet
->getPageSetup()
->setScale($scale, false);
$this->_phpSheet
->getPageSetup()
->setFitToPage((bool) $this->_isFitToPages);
$this->_phpSheet
->getPageSetup()
->setFitToWidth($fitToWidth, false);
$this->_phpSheet
->getPageSetup()
->setFitToHeight($fitToHeight, false);
}
// offset: 16; size: 8; header margin (IEEE 754 floating-point value)
$marginHeader = self::_extractNumber(substr($recordData, 16, 8));
$this->_phpSheet
->getPageMargins()
->setHeader($marginHeader);
// offset: 24; size: 8; footer margin (IEEE 754 floating-point value)
$marginFooter = self::_extractNumber(substr($recordData, 24, 8));
$this->_phpSheet
->getPageMargins()
->setFooter($marginFooter);
}
}