Example usage for org.apache.poi.xssf.streaming SXSSFSheet getMergedRegion

List of usage examples for org.apache.poi.xssf.streaming SXSSFSheet getMergedRegion

Introduction

In this page you can find the example usage for org.apache.poi.xssf.streaming SXSSFSheet getMergedRegion.

Prototype

@Override
public CellRangeAddress getMergedRegion(int index) 

Source Link

Document

Returns the merged region at the specified index.

Usage

From source file:com.plugin.excel.util.ExcelUtil.java

License:Apache License

/**
 * /* ww w  .ja  v  a2 s .  com*/
 * @param sheet
 *            the sheet containing the data.
 * @param rowNum
 *            the num of the row to copy.
 * @param cellNum
 *            the num of the cell to copy.
 * @return the CellRangeAddress created.
 */
public static CellRangeAddress getMergedRegion(SXSSFSheet sheet, int rowNum, short cellNum) {
    for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
        CellRangeAddress merged = sheet.getMergedRegion(i);
        if (merged.isInRange(rowNum, cellNum)) {
            return merged;
        }
    }
    return null;
}