Example usage for org.apache.poi.ss.util CellRangeUtil mergeCellRanges

List of usage examples for org.apache.poi.ss.util CellRangeUtil mergeCellRanges

Introduction

In this page you can find the example usage for org.apache.poi.ss.util CellRangeUtil mergeCellRanges.

Prototype

private static List<CellRangeAddress> mergeCellRanges(List<CellRangeAddress> cellRangeList) 

Source Link

Usage

From source file:com.vaadin.addon.spreadsheet.command.CellShiftValuesCommand.java

License:Open Source License

@Override
public CellRangeAddress getPaintedCellRange() {
    CellRangeAddress paintedCellRange = super.getPaintedCellRange();
    if (undone || paintedCellRange == null) {
        return paintedCellRange;
    } else {/* ww w . java2 s  .c  o  m*/
        CellRangeValue crv = (CellRangeValue) values.get(0);
        if (decrease) {
            int col2 = crv.col1 == paintedCellRange.getFirstColumn() ? crv.col2 : crv.col1 - 1;
            int row2 = crv.row1 == paintedCellRange.getFirstRow() ? crv.row2 : crv.row1 - 1;
            return new CellRangeAddress(paintedCellRange.getFirstRow(), row2, paintedCellRange.getFirstColumn(),
                    col2);
        } else {
            return CellRangeUtil.mergeCellRanges(new CellRangeAddress[] { paintedCellRange,
                    new CellRangeAddress(crv.row1, crv.row2, crv.col1, crv.col2) })[0];
        }
    }
}