Read Print Settings Page Order in Xls Reader

And eliminate switch for simple boolean portrait/landscape option
This commit is contained in:
MarkBaker 2020-06-30 00:53:10 +02:00
parent 21b34f0afb
commit 362b18ca12
1 changed files with 5 additions and 10 deletions

View File

@ -3444,6 +3444,9 @@ class Xls extends BaseReader
// offset: 10; size: 2; option flags // offset: 10; size: 2; option flags
// bit: 0; mask: 0x0001; 0=landscape, 1=portrait
$isOverThenDown= (0x0001 & self::getUInt2d($recordData, 10));
// bit: 1; mask: 0x0002; 0=landscape, 1=portrait // bit: 1; mask: 0x0002; 0=landscape, 1=portrait
$isPortrait = (0x0002 & self::getUInt2d($recordData, 10)) >> 1; $isPortrait = (0x0002 & self::getUInt2d($recordData, 10)) >> 1;
@ -3453,16 +3456,8 @@ class Xls extends BaseReader
if (!$isNotInit) { if (!$isNotInit) {
$this->phpSheet->getPageSetup()->setPaperSize($paperSize); $this->phpSheet->getPageSetup()->setPaperSize($paperSize);
switch ($isPortrait) { $this->phpSheet->getPageSetup()->setPageOrder(((bool) $isOverThenDown) ? PageSetup::PAGEORDER_OVER_THEN_DOWN : PageSetup::PAGEORDER_DOWN_THEN_OVER);
case 0: $this->phpSheet->getPageSetup()->setOrientation(((bool) $isPortrait) ? PageSetup::ORIENTATION_PORTRAIT : PageSetup::ORIENTATION_LANDSCAPE);
$this->phpSheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
break;
case 1:
$this->phpSheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_PORTRAIT);
break;
}
$this->phpSheet->getPageSetup()->setScale($scale, false); $this->phpSheet->getPageSetup()->setScale($scale, false);
$this->phpSheet->getPageSetup()->setFitToPage((bool) $this->isFitToPages); $this->phpSheet->getPageSetup()->setFitToPage((bool) $this->isFitToPages);