Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php
private function writeMergedCells()
    {
        $mergeCells = $this->phpSheet->getMergeCells();
        $countMergeCells = count($mergeCells);

        if ($countMergeCells == 0) {
            return;
        }

        // maximum allowed number of merged cells per record
        $maxCountMergeCellsPerRecord = 1027;

        // record identifier
        $record = 0x00E5;

        // counter for total number of merged cells treated so far by the writer
        $i = 0;

        // counter for number of merged cells written in record currently being written
        $j = 0;

        // initialize record data
        $recordData = '';

        // loop through the merged cells
        foreach ($mergeCells as $mergeCell) {
            ++$i;
            ++$j;

            // extract the row and column indexes
            $range = Coordinate::splitRange($mergeCell);
            list($first, $last) = $range[0];
            list($firstColumn, $firstRow) = Coordinate::coordinateFromString($first);
            list($lastColumn, $lastRow) = Coordinate::coordinateFromString($last);

            $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Coordinate::columnIndexFromString($firstColumn) - 1, Coordinate::columnIndexFromString($lastColumn) - 1);

            // flush record if we have reached limit for number of merged cells, or reached final merged cell
            if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
                $recordData = pack('v', $j) . $recordData;
                $length = strlen($recordData);
                $header = pack('vv', $record, $length);
                $this->append($header . $recordData);

                // initialize for next record, if any
                $recordData = '';
                $j = 0;
            }
        }
    }
private function writeMergedCells()
    {
        $mergeCells = $this->phpSheet->getMergeCells();
        $countMergeCells = count($mergeCells);

        if ($countMergeCells == 0) {
            return;
        }

        // maximum allowed number of merged cells per record
        $maxCountMergeCellsPerRecord = 1027;

        // record identifier
        $record = 0x00E5;

        // counter for total number of merged cells treated so far by the writer
        $i = 0;

        // counter for number of merged cells written in record currently being written
        $j = 0;

        // initialize record data
        $recordData = '';

        // loop through the merged cells
        foreach ($mergeCells as $mergeCell) {
            ++$i;
            ++$j;

            // extract the row and column indexes
            $range = Coordinate::splitRange($mergeCell);
            list($first, $last) = $range[0];
            list($firstColumn, $firstRow) = Coordinate::coordinateFromString($first);
            list($lastColumn, $lastRow) = Coordinate::coordinateFromString($last);

            $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Coordinate::columnIndexFromString($firstColumn) - 1, Coordinate::columnIndexFromString($lastColumn) - 1);

            // flush record if we have reached limit for number of merged cells, or reached final merged cell
            if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
                $recordData = pack('v', $j) . $recordData;
                $length = strlen($recordData);
                $header = pack('vv', $record, $length);
                $this->append($header . $recordData);

                // initialize for next record, if any
                $recordData = '';
                $j = 0;
            }
        }
    }
Store the MERGEDCELLS records for all ranges of merged cells.