Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php
private function writeSetup()
    {
        $record = 0x00A1; // Record identifier
        $length = 0x0022; // Number of bytes to follow

        $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size

        $iScale = $this->phpSheet->getPageSetup()->getScale() ?
            $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor

        $iPageStart = 0x01; // Starting page number
        $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide
        $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high
        $grbit = 0x00; // Option flags
        $iRes = 0x0258; // Print resolution
        $iVRes = 0x0258; // Vertical print resolution

        $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin

        $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin
        $iCopies = 0x01; // Number of copies

        $fLeftToRight = 0x0; // Print over then down

        // Page orientation
        $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ?
            0x0 : 0x1;

        $fNoPls = 0x0; // Setup not read from printer
        $fNoColor = 0x0; // Print black and white
        $fDraft = 0x0; // Print draft quality
        $fNotes = 0x0; // Print notes
        $fNoOrient = 0x0; // Orientation not set
        $fUsePage = 0x0; // Use custom starting page

        $grbit = $fLeftToRight;
        $grbit |= $fLandscape << 1;
        $grbit |= $fNoPls << 2;
        $grbit |= $fNoColor << 3;
        $grbit |= $fDraft << 4;
        $grbit |= $fNotes << 5;
        $grbit |= $fNoOrient << 6;
        $grbit |= $fUsePage << 7;

        $numHdr = pack('d', $numHdr);
        $numFtr = pack('d', $numFtr);
        if (self::getByteOrder()) { // if it's Big Endian
            $numHdr = strrev($numHdr);
            $numFtr = strrev($numFtr);
        }

        $header = pack('vv', $record, $length);
        $data1 = pack('vvvvvvvv', $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
        $data2 = $numHdr . $numFtr;
        $data3 = pack('v', $iCopies);
        $this->append($header . $data1 . $data2 . $data3);
    }
private function writeSetup()
    {
        $record = 0x00A1; // Record identifier
        $length = 0x0022; // Number of bytes to follow

        $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size

        $iScale = $this->phpSheet->getPageSetup()->getScale() ?
            $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor

        $iPageStart = 0x01; // Starting page number
        $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide
        $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high
        $grbit = 0x00; // Option flags
        $iRes = 0x0258; // Print resolution
        $iVRes = 0x0258; // Vertical print resolution

        $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin

        $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin
        $iCopies = 0x01; // Number of copies

        $fLeftToRight = 0x0; // Print over then down

        // Page orientation
        $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ?
            0x0 : 0x1;

        $fNoPls = 0x0; // Setup not read from printer
        $fNoColor = 0x0; // Print black and white
        $fDraft = 0x0; // Print draft quality
        $fNotes = 0x0; // Print notes
        $fNoOrient = 0x0; // Orientation not set
        $fUsePage = 0x0; // Use custom starting page

        $grbit = $fLeftToRight;
        $grbit |= $fLandscape << 1;
        $grbit |= $fNoPls << 2;
        $grbit |= $fNoColor << 3;
        $grbit |= $fDraft << 4;
        $grbit |= $fNotes << 5;
        $grbit |= $fNoOrient << 6;
        $grbit |= $fUsePage << 7;

        $numHdr = pack('d', $numHdr);
        $numFtr = pack('d', $numFtr);
        if (self::getByteOrder()) { // if it's Big Endian
            $numHdr = strrev($numHdr);
            $numFtr = strrev($numFtr);
        }

        $header = pack('vv', $record, $length);
        $data1 = pack('vvvvvvvv', $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
        $data2 = $numHdr . $numFtr;
        $data3 = pack('v', $iCopies);
        $this->append($header . $data1 . $data2 . $data3);
    }
Store the page setup SETUP BIFF record.