25 if (isset($sheet->PrintInformation)) {
26 $printInformation = $sheet->PrintInformation[0];
27 $scale = (string) $printInformation->Scale->attributes()[
'percentage'];
28 $pageOrder = (string) $printInformation->order;
29 $orientation = (
string) $printInformation->orientation;
30 $horizontalCentered = (string) $printInformation->hcenter->attributes()[
'value'];
31 $verticalCentered = (string) $printInformation->vcenter->attributes()[
'value'];
33 $this->spreadsheet->getActiveSheet()->getPageSetup()
34 ->setPageOrder($pageOrder ===
'r_then_d' ? WorksheetPageSetup::PAGEORDER_OVER_THEN_DOWN : WorksheetPageSetup::PAGEORDER_DOWN_THEN_OVER)
35 ->setScale((
int) $scale)
36 ->setOrientation($orientation ?? WorksheetPageSetup::ORIENTATION_DEFAULT)
37 ->setHorizontalCentered((
bool) $horizontalCentered)
38 ->setVerticalCentered((
bool) $verticalCentered);
46 if (isset($sheet->PrintInformation, $sheet->PrintInformation->Margins)) {
67 $marginAttributes = $margin->attributes();
68 $marginSize = ($marginAttributes[
'Points']) ?? 72;
70 $marginSize = PageMargins::fromPoints((
float) $marginSize);
71 $marginSet[
$key] = $marginSize;
79 foreach ($marginSet as
$key => $marginSize) {
113 $this->spreadsheet->getActiveSheet()->getPageMargins()->setTop($marginSize);
117 $this->spreadsheet->getActiveSheet()->getPageMargins()->setBottom($marginSize);
121 $this->spreadsheet->getActiveSheet()->getPageMargins()->setLeft($marginSize);
125 $this->spreadsheet->getActiveSheet()->getPageMargins()->setRight($marginSize);
129 $this->spreadsheet->getActiveSheet()->getPageMargins()->setHeader($marginSize);
133 $this->spreadsheet->getActiveSheet()->getPageMargins()->setFooter($marginSize);
sheetMargins(SimpleXMLElement $sheet)
buildMarginSet(SimpleXMLElement $sheet, array $marginSet)
printInformation(SimpleXMLElement $sheet)
adjustMargins(array $marginSet)
__construct(Spreadsheet $spreadsheet)
sheetMargin(string $key, float $marginSize)