code: private function writePageSetup(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet)
      {
          // pageSetup
          $objWriter->startElement('pageSetup');
          $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
          $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
  
          if ($pSheet->getPageSetup()->getScale() !== null) {
              $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
          }
          if ($pSheet->getPageSetup()->getFitToHeight() !== null) {
              $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
          } else {
              $objWriter->writeAttribute('fitToHeight', '0');
          }
          if ($pSheet->getPageSetup()->getFitToWidth() !== null) {
              $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
          } else {
              $objWriter->writeAttribute('fitToWidth', '0');
          }
          if ($pSheet->getPageSetup()->getFirstPageNumber() !== null) {
              $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
              $objWriter->writeAttribute('useFirstPageNumber', '1');
          }
  
          $objWriter->endElement();
      }
docs: Write PageSetup.
  
  @param XMLWriter $objWriter XML Writer
  @param PhpspreadsheetWorksheet $pSheet Worksheet