Support pageOrder in page setup for Xlsx Reader and Writer

This commit is contained in:
MarkBaker 2020-06-29 20:15:41 +02:00
parent 8712fb0424
commit a0bba38281
3 changed files with 25 additions and 0 deletions

View File

@ -69,6 +69,9 @@ class PageSetup extends BaseParserClass
self::boolean((string) $xmlSheet->pageSetup['useFirstPageNumber'])) {
$docPageSetup->setFirstPageNumber((int) ($xmlSheet->pageSetup['firstPageNumber']));
}
if (isset($xmlSheet->pageSetup['pageOrder'])) {
$docPageSetup->setPageOrder((string) $xmlSheet->pageSetup['pageOrder']);
}
$relAttributes = $xmlSheet->pageSetup->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships');
if (isset($relAttributes['id'])) {

View File

@ -156,6 +156,9 @@ class PageSetup
const SETPRINTRANGE_OVERWRITE = 'O';
const SETPRINTRANGE_INSERT = 'I';
const PAGEORDER_OVER_THEN_DOWN = 'overThenDown';
const PAGEORDER_DOWN_THEN_OVER = 'downThenOver';
/**
* Paper size.
*
@ -246,6 +249,8 @@ class PageSetup
*/
private $firstPageNumber;
private $pageOrder;
/**
* Create a new PageSetup.
*/
@ -818,6 +823,20 @@ class PageSetup
return $this->setFirstPageNumber(null);
}
public function getPageOrder(): string
{
return $this->pageOrder;
}
public function setPageOrder(?string $pageOrder): self
{
if ($pageOrder === null || $pageOrder === self::PAGEORDER_DOWN_THEN_OVER || $pageOrder === self::PAGEORDER_OVER_THEN_DOWN) {
$this->pageOrder = $pageOrder;
}
return $this;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/

View File

@ -875,6 +875,9 @@ class Worksheet extends WriterPart
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
$objWriter->writeAttribute('useFirstPageNumber', '1');
}
if ($pSheet->getPageSetup()->getPageOrder() !== null) {
$objWriter->writeAttribute('pageOrder', $pSheet->getPageSetup()->getPageOrder());
}
$getUnparsedLoadedData = $pSheet->getParent()->getUnparsedLoadedData();
if (isset($getUnparsedLoadedData['sheets'][$pSheet->getCodeName()]['pageSetupRelId'])) {