Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php
public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
    {
        $FILE = $this->fileHandle;

        // Calculate Basic Setting
        $iBlCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE;
        $i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE;

        $iBdExL = 0;
        $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
        $iAllW = $iAll;
        $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
        $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);

        // Calculate BD count
        if ($iBdCnt > $i1stBdL) {
            while (1) {
                ++$iBdExL;
                ++$iAllW;
                $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);
                if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) {
                    break;
                }
            }
        }

        // Save Header
        fwrite(
            $FILE,
            "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . pack('v', 0x3b)
            . pack('v', 0x03)
            . pack('v', -2)
            . pack('v', 9)
            . pack('v', 6)
            . pack('v', 0)
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . pack('V', $iBdCnt)
            . pack('V', $iBBcnt + $iSBDcnt) //ROOT START
            . pack('V', 0)
            . pack('V', 0x1000)
            . pack('V', $iSBDcnt ? 0 : -2) //Small Block Depot
            . pack('V', $iSBDcnt)
        );
        // Extra BDList Start, Count
        if ($iBdCnt < $i1stBdL) {
            fwrite(
                $FILE,
                pack('V', -2) // Extra BDList Start
                . pack('V', 0)// Extra BDList Count
            );
        } else {
            fwrite($FILE, pack('V', $iAll + $iBdCnt) . pack('V', $iBdExL));
        }

        // BDList
        for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
            fwrite($FILE, pack('V', $iAll + $i));
        }
        if ($i < $i1stBdL) {
            $jB = $i1stBdL - $i;
            for ($j = 0; $j < $jB; ++$j) {
                fwrite($FILE, (pack('V', -1)));
            }
        }
    }
public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
    {
        $FILE = $this->fileHandle;

        // Calculate Basic Setting
        $iBlCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE;
        $i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE;

        $iBdExL = 0;
        $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
        $iAllW = $iAll;
        $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
        $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);

        // Calculate BD count
        if ($iBdCnt > $i1stBdL) {
            while (1) {
                ++$iBdExL;
                ++$iAllW;
                $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);
                if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) {
                    break;
                }
            }
        }

        // Save Header
        fwrite(
            $FILE,
            "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . pack('v', 0x3b)
            . pack('v', 0x03)
            . pack('v', -2)
            . pack('v', 9)
            . pack('v', 6)
            . pack('v', 0)
            . "\x00\x00\x00\x00"
            . "\x00\x00\x00\x00"
            . pack('V', $iBdCnt)
            . pack('V', $iBBcnt + $iSBDcnt) //ROOT START
            . pack('V', 0)
            . pack('V', 0x1000)
            . pack('V', $iSBDcnt ? 0 : -2) //Small Block Depot
            . pack('V', $iSBDcnt)
        );
        // Extra BDList Start, Count
        if ($iBdCnt < $i1stBdL) {
            fwrite(
                $FILE,
                pack('V', -2) // Extra BDList Start
                . pack('V', 0)// Extra BDList Count
            );
        } else {
            fwrite($FILE, pack('V', $iAll + $iBdCnt) . pack('V', $iBdExL));
        }

        // BDList
        for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
            fwrite($FILE, pack('V', $iAll + $i));
        }
        if ($i < $i1stBdL) {
            $jB = $i1stBdL - $i;
            for ($j = 0; $j < $jB; ++$j) {
                fwrite($FILE, (pack('V', -1)));
            }
        }
    }
public function _saveHeader ( $ iSBDcnt , $ iBBcnt , $ iPPScnt ) { $ FILE = $ this -> fileHandle ; // Calculate Basic Setting $ iBlCnt = $ this -> bigBlockSize / OLE :: OLE_LONG_INT_SIZE ; $ i1stBdL = ( $ this -> bigBlockSize - 0x4C ) / OLE :: OLE_LONG_INT_SIZE ; $ iBdExL = 0 ; $ iAll = $ iBBcnt + $ iPPScnt + $ iSBDcnt ; $ iAllW = $ iAll ; $ iBdCntW = floor ( $ iAllW / $ iBlCnt ) + ( ( $ iAllW % $ iBlCnt ) ? 1 : 0 ) ; $ iBdCnt = floor ( ( $ iAll + $ iBdCntW ) / $ iBlCnt ) + ( ( ( $ iAllW + $ iBdCntW ) % $ iBlCnt ) ? 1 : 0 ) ; // Calculate BD count if ( $ iBdCnt > $ i1stBdL ) { while ( 1 ) { ++ $ iBdExL ; ++ $ iAllW ; $ iBdCntW = floor ( $ iAllW / $ iBlCnt ) + ( ( $ iAllW % $ iBlCnt ) ? 1 : 0 ) ; $ iBdCnt = floor ( ( $ iAllW + $ iBdCntW ) / $ iBlCnt ) + ( ( ( $ iAllW + $ iBdCntW ) % $ iBlCnt ) ? 1 : 0 ) ; if ( $ iBdCnt <= ( $ iBdExL * $ iBlCnt + $ i1stBdL ) ) { break ; } } } // Save Header fwrite ( $ FILE , "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . pack ( 'v' , 0x3b ) . pack ( 'v' , 0x03 ) . pack ( 'v' , - 2 ) . pack ( 'v' , 9 ) . pack ( 'v' , 6 ) . pack ( 'v' , 0 ) . "\x00\x00\x00\x00" . "\x00\x00\x00\x00" . pack ( 'V' , $ iBdCnt ) . pack ( 'V' , $ iBBcnt + $ iSBDcnt ) //ROOT START . pack ( 'V' , 0 ) . pack ( 'V' , 0x1000 ) . pack ( 'V' , $ iSBDcnt ? 0 : - 2 ) //Small Block Depot . pack ( 'V' , $ iSBDcnt ) ) ; // Extra BDList Start, Count if ( $ iBdCnt < $ i1stBdL ) { fwrite ( $ FILE , pack ( 'V' , - 2 ) // Extra BDList Start . pack ( 'V' , 0 ) // Extra BDList Count ) ; } else { fwrite ( $ FILE , pack ( 'V' , $ iAll + $ iBdCnt ) . pack ( 'V' , $ iBdExL ) ) ; } // BDList for ( $ i = 0 ; $ i < $ i1stBdL && $ i < $ iBdCnt ; ++ $ i ) { fwrite ( $ FILE , pack ( 'V' , $ iAll + $ i ) ) ; } if ( $ i < $ i1stBdL ) { $ jB = $ i1stBdL - $ i ; for ( $ j = 0 ; $ j < $ jB ; ++ $ j ) { fwrite ( $ FILE , ( pack ( 'V' , - 1 ) ) ) ; } } }
Save OLE header.

@param int $iSBDcnt
@param int $iBBcnt
@param int $iPPScnt
Save OLE header .