指定した範囲の結合を解除する。
@param sheet
@param mergedRange
@return 引数で指定した結合が見つからない場合。
340648
public static boolean removeMergedRange(final Sheet sheet, final CellRangeAddress mergedRange) {
        ArgUtils.notNull(sheet, "sheet");
        ArgUtils.notNull(mergedRange, "mergedRange");

        final String mergedAddress = mergedRange.formatAsString(sheet.getSheetName(), true);

        final int num = sheet.getNumMergedRegions();
        for(int i=0; i < num; i ++) {
            final CellRangeAddress range = sheet.getMergedRegion(i);
            final String rangeAddress = range.formatAsString(sheet.getSheetName(), true);
            if(rangeAddress.equals(mergedAddress)) {
                sheet.removeMergedRegion(i);
                return true;
            }
        }

        return false;
    }
1314592
def contains_merged_cell(self):
        """"""
        for tc in self.iter_tcs():
            if tc.gridSpan > 1:
                return True
            if tc.rowSpan > 1:
                return True
            if tc.hMerge:
                return True
            if tc.vMerge:
                return True
        return False
65194
def merge(target)
      start, stop = if target.is_a?(String)
                      [self.r, target]
                    elsif(target.is_a?(Cell))
                      Axlsx.sort_cells([self, target]).map { |c| c.r }
                    end
      self.row.worksheet.merge_cells "#{start}:#{stop}" unless stop.nil?
    end
680919
function _storeMergedCells()
    {
        // if there are no merged cell ranges set, return
        if (count($this->_merged_ranges) == 0) {
            return;
        }
        $record   = 0x00E5;
        $length   = 2 + count($this->_merged_ranges) * 8;

        $header   = pack('vv', $record, $length);
        $data     = pack('v',  count($this->_merged_ranges));
        foreach ($this->_merged_ranges as $range) {
            $data .= pack('vvvv', $range[0], $range[2], $range[1], $range[3]);
        }
        $this->_append($header . $data);
    }
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);
    }
838098
public LCMSDataSubset merge(LCMSDataSubset other) {
    LCMSDataSubset merged = new LCMSDataSubset();

    Set<Integer> msLvlsThis = getMsLvls();
    Set<Integer> msLvlsThat = other.getMsLvls();
    // only merge if both are not null, otherwise null signifies the whole
    // run, so we can keep it null in the merged version
    if (msLvlsThis != null && msLvlsThat != null) {
      HashSet<Integer> mergedMsLvls = new HashSet<>(msLvlsThis);
      mergedMsLvls.addAll(msLvlsThat);
      merged.setMsLvls(mergedMsLvls);
    }

    // merge mz ranges
    List<DoubleRange> mzRangesThis = getMzRanges();
    List<DoubleRange> mzRangesThat = other.getMzRanges();
    if (mzRangesThis != null && mzRangesThat != null) {
      ArrayList<DoubleRange> mergedMzRanges = new ArrayList<>(mzRangesThis);
      mergedMzRanges.addAll(mzRangesThat);
      merged.setMzRanges(mergedMzRanges);
    }

    // compare scan number ranges
    Integer scanNumLoThis = getScanNumLo();
    Integer scanNumLoThat = other.getScanNumLo();
    if (scanNumLoThis != null && scanNumLoThat != null) {
      merged.setScanNumLo(Math.min(scanNumLoThis, scanNumLoThat));
    }
    Integer scanNumHiThis = getScanNumHi();
    Integer scanNumHiThat = other.getScanNumHi();
    if (scanNumHiThis != null && scanNumHiThat != null) {
      merged.setScanNumHi(Math.max(scanNumHiThis, scanNumHiThat));
    }

    return merged;
  }
808233
public function getMergeRange()
    {
        foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) {
            if ($this->isInRange($mergeRange)) {
                return $mergeRange;
            }
        }
        return false;
    }
491797
@Override
  public void merge(MergeState mergeState) throws IOException {
    final List<Fields> fields = new ArrayList<>();
    final List<ReaderSlice> slices = new ArrayList<>();

    int docBase = 0;

    for (int readerIndex = 0; readerIndex < mergeState.fieldsProducers.length; readerIndex++) {
      final FieldsProducer f = mergeState.fieldsProducers[readerIndex];

      final int maxDoc = mergeState.maxDocs[readerIndex];
      f.checkIntegrity();
      slices.add(new ReaderSlice(docBase, maxDoc, readerIndex));
      fields.add(f);
      docBase += maxDoc;
    }

    Fields mergedFields = new MappedMultiFields(mergeState,
        new MultiFields(fields.toArray(Fields.EMPTY_ARRAY),
            slices.toArray(ReaderSlice.EMPTY_ARRAY)));
    write(mergedFields);
  }
1061419
@Override
    public boolean overlaps(Range<T> other) {
        dbc.precondition(other != null, "checking for overlaps between a DenseRange<T> and null");
        if (other instanceof DenseRange == false) {
            return other.overlaps(this);
        }
        return !Order.of(comparator, Optional.of(this.begin()), other.end()).isGte() && !Order.of(comparator, Optional.of(other.begin()), this.end()).isGte();
    }
232454
def search_mergedcell_value(xl_sheet, merged_range):
    
    for search_row_idx in range(merged_range[0], merged_range[1]):
        for search_col_idx in range(merged_range[2], merged_range[3]):
            if xl_sheet.cell(search_row_idx, search_col_idx).value:
                return xl_sheet.cell(search_row_idx, search_col_idx)
    return False
122383
public ExcelWriter merge(int lastColumn, Object content, boolean isSetHeaderStyle) {
		Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");

		final int rowIndex = this.currentRow.get();
		merge(rowIndex, rowIndex, 0, lastColumn, content, isSetHeaderStyle);

		// 设置内容后跳到下一行
		if (null != content) {
			this.currentRow.incrementAndGet();
		}
		return this;
	}
1070274
public IndexRange mergedWith(IndexRange other) {
        checkArgNotNull(other, "other");
        return new IndexRange(Math.min(start, other.start), Math.max(end, other.end));
    }
1234529
private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
	{
		if (count($pSheet->getMergeCells()) > 0) {
			// mergeCells
			$objWriter->startElement('mergeCells');

				// Loop mergeCells
				foreach ($pSheet->getMergeCells() as $mergeCell) {
					// mergeCell
					$objWriter->startElement('mergeCell');
					$objWriter->writeAttribute('ref', $mergeCell);
					$objWriter->endElement();
				}

			$objWriter->endElement();
		}
	}
143427
function(cell1,cell2){
		if(!cell1.room || !cell2.room || cell1.room===cell2.room){ return;}
		var merged, keep;
		var tcell1 = cell1.room.top;
		var tcell2 = cell2.room.top;
		if(tcell1.bx>tcell2.bx || (tcell1.bx===tcell2.bx && tcell1.by>tcell2.by)){ merged = tcell1; keep = tcell2;}
		else                                                                     { merged = tcell2; keep = tcell1;}

		// 消える部屋のほうの数字を消す
		if(merged.isNum()){
			// 数字が消える部屋にしかない場合 -> 残るほうに移動させる
			if(keep.noNum()){
				keep.setQnum(merged.qnum);
				keep.draw();
			}
			merged.setQnum(-1);
			merged.draw();
		}
	}
291319
private void correctNameRange(final Sheet sheet, final RecordOperation recordOperation) {

        if(recordOperation.isNotExecuteRecordOperation()) {
            return;
        }

        final Workbook workbook = sheet.getWorkbook();
        final int numName = workbook.getNumberOfNames();
        if(numName == 0) {
            return;
        }

        // 操作をしていないセルの範囲の取得
        final CellRangeAddress notOperateRange = new CellRangeAddress(
                recordOperation.getTopLeftPoisitoin().y,
                recordOperation.getBottomRightPosition().y - recordOperation.getCountInsertRecord(),
                recordOperation.getTopLeftPoisitoin().x,
                recordOperation.getBottomRightPosition().x
                );

        for(int i=0; i < numName; i++) {
            final Name name = workbook.getNameAt(i);

            if(name.isDeleted() || name.isFunctionName()) {
                // 削除されている場合、関数の場合はスキップ
                continue;
            }

            if(!sheet.getSheetName().equals(name.getSheetName())) {
                // 自身のシートでない名前は、修正しない。
                continue;
            }

            AreaReference areaRef = new AreaReference(name.getRefersToFormula(), POIUtils.getVersion(sheet));
            CellReference firstCellRef = areaRef.getFirstCell();
            CellReference lastCellRef = areaRef.getLastCell();

            if(notOperateRange.isInRange(firstCellRef.getRow(), firstCellRef.getCol())) {
                // 自身のセルの範囲の場合は、行の範囲を広げる。

                lastCellRef= new CellReference(
                        lastCellRef.getSheetName(),
                        recordOperation.getBottomRightPosition().y, lastCellRef.getCol(),
                        lastCellRef.isRowAbsolute(), lastCellRef.isColAbsolute());
                areaRef = new AreaReference(firstCellRef, lastCellRef, sheet.getWorkbook().getSpreadsheetVersion());

                // 修正した範囲を再設定する
                name.setRefersToFormula(areaRef.formatAsString());

            } else if(notOperateRange.getLastRow() < firstCellRef.getRow()) {
                /*
                 * 名前の定義の場合、自身のセルの範囲より下方にあるセルの範囲の場合、
                 * 自動的に修正されるため、修正は必要なし。
                 */

            }

        }

    }
723372
public static int shiftRows(Sheet sheet, int itemSize, int targetRowNum) {
        int lastRowNum = sheet.getLastRowNum();
        if (itemSize == 0 && targetRowNum == lastRowNum) { // 没有写入行，直接删除模板行
            sheet.removeRow(sheet.getRow(targetRowNum));
        } else if (itemSize != 1 && targetRowNum < lastRowNum) {
            sheet.shiftRows(targetRowNum + 1, lastRowNum, itemSize - 1, true, true);
        }

        return itemSize;
    }
943461
public IVersionRange merge(IVersionRange... ranges) {
    if (ranges.length < 2) {
      return ranges[0];
    }

    // Check the type of the first range
    if (!(ranges[0] instanceof VersionRange)) {
      if (!(ranges[0] instanceof OrRange)) {
        throw new UnsupportedOperationException("Incorrect type for ranges[0]");
      }
      if (((OrRange) ranges[0]).size() != 2) {
        throw new UnsupportedOperationException("Incorrect size for ranges[0]");
      }
    }
    else {
      if (!((VersionRange) ranges[0]).isUnbounded()) {
        throw new UnsupportedOperationException("ranges[0] should be unbounded (> or >=)");
      }
    }

    int lastIndex = ranges.length - 1;

    // Check the type of the last range
    if (!(ranges[lastIndex] instanceof VersionRange)) {
      if (!(ranges[lastIndex] instanceof OrRange)) {
        throw new UnsupportedOperationException("Incorrect type for ranges[last]");
      }
      if (((OrRange) ranges[lastIndex]).size() != 2) {
        throw new UnsupportedOperationException("Incorrect size for ranges[last]");
      }
    }
    else {
      if (((VersionRange) ranges[lastIndex]).isUnbounded()) {
        throw new UnsupportedOperationException("ranges[0] should be bounded (< or <=)");
      }
    }

    // Check the rest of the types
    for (int i = 1; i < lastIndex; i++) {
      if (!(ranges[i] instanceof OrRange)) {
        throw new UnsupportedOperationException("Incorrect type for ranges[" + i + "]");
      }

      if (((OrRange) ranges[i]).size() != 2) {
        throw new UnsupportedOperationException("Incorrect size for ranges[" + i + "]");
      }
    }

    List<IVersionRange> results = new LinkedList<IVersionRange>();
    IVersionRange last = null;
    for (int i = 0; i < ranges.length; i++) {
      IVersionRange range = ranges[i];
      if (last == null) {
        if (range instanceof VersionRange) {
          last = range;
        }
        else {
          OrRange orange = (OrRange) range;
          results.add(orange.first());
          last = orange.last();
        }
      }
      else {
        if (range instanceof VersionRange) {
          AndRange arange = new AndRange(last, range);
          results.add(arange);
          last = null;
        }
        else {
          OrRange orange = (OrRange) range;
          AndRange arange = new AndRange(last, orange.first());
          results.add(arange);
          last = orange.last();
        }
      }
    }

    if (last != null) {
      results.add(last);
    }

    return new OrRange(results);
  }