Write the <mergeCell> element.
510481
def write_merge_cell(merged_range) #:nodoc:
      row_min, col_min, row_max, col_max = merged_range

      # Convert the merge dimensions to a cell range.
      cell_1 = xl_rowcol_to_cell(row_min, col_min)
      cell_2 = xl_rowcol_to_cell(row_max, col_max)

      @writer.empty_tag('mergeCell', [ ['ref', "#{cell_1}:#{cell_2}"] ])
    end
1040204
def write_two_cell_anchor(*args)
      index, type, col_from, row_from, col_from_offset, row_from_offset,
      col_to, row_to, col_to_offset, row_to_offset, col_absolute, row_absolute,
      width, height, description, shape = args

      attributes      = []

      # Add attribute for images.
      attributes << [:editAs, 'oneCell'] if type == 2

      # Add attribute for shapes.
      attributes << [:editAs, shape.edit_as] if shape && shape.edit_as

      @writer.tag_elements('xdr:twoCellAnchor', attributes) do
        # Write the xdr:from element.
        write_from(col_from, row_from, col_from_offset, row_from_offset)
        # Write the xdr:to element.
        write_to(col_to, row_to, col_to_offset, row_to_offset)

        if type == 1
          # Graphic frame.

          # Write the xdr:graphicFrame element for charts.
          write_graphic_frame(index, description)
        elsif type == 2
          # Write the xdr:pic element.
          write_pic(index, col_absolute, row_absolute, width, height, description)
        else
          # Write the xdr:sp element for shapes.
          write_sp(index, col_absolute, row_absolute, width, height, shape)
        end

        # Write the xdr:clientData element.
        write_client_data
      end
    end
312152
protected void writeCombiner( TupleCombiner combiner)
    {
    writer_
      .element( COMBINE_TAG)
      .attribute( TUPLES_ATR, String.valueOf( combiner.getTupleSize()))
      .content( () ->
        {
        Arrays.stream( combiner.getIncluded())
          .sorted()
          .forEach( this::writeIncluded);
        
        Arrays.stream( combiner.getExcluded())
          .sorted()
          .forEach( this::writeExcluded);

        toStream( combiner.getOnceTuples()).forEach( this::writeOnceTuple);
        })
      .write();
    }
455067
def putcell(self, rownr, value):
        """"""
        return self._table.putcell(self._column, rownr, value)
1108209
public void newCell(final int row,
            final int column,
            final String value,
            final int mergedColStart) {
        if ( emptyCellValue( value ) ) {
            return;
        }
        final Integer rowInt = new Integer( row );
        if ( this._rowProperties.containsKey( rowInt ) ) {
            final String[] keyValue = (String[]) this._rowProperties.get( rowInt );
            if ( PropertiesSheetListener.EMPTY_STRING.equals( keyValue[1] ) ) {
                keyValue[1] = value;
                keyValue[2] = RuleSheetParserUtil.rc2name(row, column);
            }
        } else {
            final String trimmedValue = value.trim();
            final String[] keyValue = {trimmedValue, PropertiesSheetListener.EMPTY_STRING, RuleSheetParserUtil.rc2name(row, column+1) };
            this._rowProperties.put( rowInt, keyValue );
        }
    }
136354
public void writeStylesCommonStyles(final XMLUtil util, final Appendable appendable)
            throws IOException {
        final Iterable<ObjectStyle> styles = this.objectStylesContainer
                .getValues(Dest.STYLES_COMMON_STYLES);
        for (final ObjectStyle style : styles)
            assert !style.isHidden() : style.toString() + " - " + style.getName() +
                    TableCellStyle.DEFAULT_CELL_STYLE.toString();

        this.write(styles, util, appendable);
    }
995864
private void mergeReturnElement(final Element stackElement) {
        if (returnElement != null)
            stackElement.merge(returnElement);
        returnElement = stackElement;
    }
127491
def unmerge(self, unmerge_area, tab):
        """"""

        top, left, bottom, right = unmerge_area
        selection = Selection([(top, left)], [(bottom, right)], [], [], [])
        attr = {"merge_area": None, "locked": False}

        self._set_cell_attr(selection, tab, attr)
324100
function write_BrtBeginMergeCells(cnt, o) {
	if(o == null) o = new_buf(4);
	o.write_shift(4, cnt);
	return o;
}
393173
def to_cell_table(self, merged=True):
    """"""
    new_rows = []
    for row_index, row in enumerate(self.rows(CellMode.cooked)):
      new_row = []
      for col_index, cell_value in enumerate(row):
        new_row.append(Cell(cell_value, self.get_note((col_index, row_index))))
      new_rows.append(new_row)
    if merged:
      for cell_low, cell_high in self.merged_cell_ranges():
        anchor_cell = new_rows[cell_low[1]][cell_low[0]]
        for row_index in range(cell_low[1], cell_high[1]):
          for col_index in range(cell_low[0], cell_high[0]):
            # NOTE: xlrd occassionally returns ranges that don't have cells.
            try:
              new_rows[row_index][col_index] = anchor_cell.copy()
            except IndexError:
              pass
    return new_rows
888792
public void setCellMerge(final int rowIndex, final int colIndex, final int rowMerge,
                             final int columnMerge) throws IOException {
        this.builder.setCellMerge(this, this.appender, rowIndex, colIndex, rowMerge, columnMerge);
    }
1320494
def write(self, handle):
        """"""
        handle.write(u"\t".join(self.columns))
        handle.write(u"\n")
        for row in self.rows:
            row.write(handle)
1368375
public void writeDefinition(final OutputStream result) throws IOException 
    {
        if(this.mergeType == MERGE_VERT_PARENT) {
            result.write(DocWriter.getISOBytes("\\clvmgf"));
        } else if(this.mergeType == MERGE_VERT_CHILD) {
            result.write(DocWriter.getISOBytes("\\clvmrg"));
        }
        switch (verticalAlignment) {
            case Element.ALIGN_BOTTOM:
                result.write(DocWriter.getISOBytes("\\clvertalb"));
                break;
            case Element.ALIGN_CENTER:
            case Element.ALIGN_MIDDLE:
                result.write(DocWriter.getISOBytes("\\clvertalc"));
                break;
            case Element.ALIGN_TOP:
                result.write(DocWriter.getISOBytes("\\clvertalt"));
                break;
        }
        this.borders.writeContent(result);

        if(this.backgroundColor != null) {
            result.write(DocWriter.getISOBytes("\\clcbpat"));
            result.write(intToByteArray(this.backgroundColor.getColorNumber()));
        }
        this.document.outputDebugLinebreak(result);
        
        result.write(DocWriter.getISOBytes("\\clftsWidth3"));
        this.document.outputDebugLinebreak(result);
        
        result.write(DocWriter.getISOBytes("\\clwWidth"));
        result.write(intToByteArray(this.cellWidth));
        this.document.outputDebugLinebreak(result);
        
        if(this.cellPadding > 0) {
            result.write(DocWriter.getISOBytes("\\clpadl"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadt"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadr"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadb"));
            result.write(intToByteArray(this.cellPadding / 2));
            result.write(DocWriter.getISOBytes("\\clpadfl3"));
            result.write(DocWriter.getISOBytes("\\clpadft3"));
            result.write(DocWriter.getISOBytes("\\clpadfr3"));
            result.write(DocWriter.getISOBytes("\\clpadfb3"));
        }
        result.write(DocWriter.getISOBytes("\\cellx"));
        result.write(intToByteArray(this.cellRight));
    }
623231
private void copyCellStyle(final Cell fromCell, final Cell toCell) {

        final CellStyle style = fromCell.getCellStyle();
        toCell.setCellStyle(style);
        toCell.setCellType(CellType.BLANK);

        // 横方向に結合されている場合、結合情報のコピーする。（XlsArrayColumns用）
        final Sheet sheet = fromCell.getSheet();
        final CellRangeAddress mergedRegion = POIUtils.getMergedRegion(sheet, fromCell.getRowIndex(), fromCell.getColumnIndex());
        final int mergedSize = POIUtils.getColumnSize(mergedRegion);

        if(POIUtils.getColumnSize(mergedRegion) >= 2) {
            CellRangeAddress newMergedRegion = POIUtils.getMergedRegion(sheet, toCell.getRowIndex(), toCell.getColumnIndex());
            if(newMergedRegion != null) {
                // 既に結合している場合 - 通常はありえない。
                return;
            }

            newMergedRegion = POIUtils.mergeCells(sheet,
                    mergedRegion.getFirstColumn(), toCell.getRowIndex(), mergedRegion.getLastColumn(), toCell.getRowIndex());

            // 結合先のセルの書式も設定する
            // 中間のセルの設定
            for(int i=1; i < mergedSize; i++) {
                Cell mergedFromCell = POIUtils.getCell(sheet, toCell.getColumnIndex()+i, fromCell.getRowIndex());

                Cell mergedToCell = POIUtils.getCell(sheet, toCell.getColumnIndex()+i, toCell.getRowIndex());
                mergedToCell.setCellStyle(mergedFromCell.getCellStyle());
                mergedToCell.setCellType(CellType.BLANK);
            }

        }

    }
1283485
private void fixCellValue(MergeRow mergeRowAnn, int fromRow, int col) {
        val sep = mergeRowAnn.prefixSeperate();
        if (StringUtils.isEmpty(sep)) return;

        val cell = sheet.getRow(fromRow).getCell(col);
        val old = PoiUtil.getCellStringValue(cell);
        val fixed = substringAfterSep(old, sep);

        PoiUtil.writeCellValue(cell, fixed);
    }
60793
def writerow(self, cells):
        
        if self.default_sheet is None:
            self.default_sheet = self.new_sheet()
        self.default_sheet.writerow(cells)
1014629
public ExcelWriter writeCellValue(int x, int y, Object value) {
		final Cell cell = getOrCreateCell(x, y);
		CellUtil.setCellValue(cell, value, this.styleSet, false);
		return this;
	}