I wanted to read an excel sheet that has one merged column and I need to treat that column to determine the rows that are grouped with. So that I can consider that group as a set. Likewise each merged rows are considered as set1, set2, set3 and so on. I will then process each set w its rows separately.
UPDATE: As Requested by @fireandfuel, I am including the approche that I have arrived.
CTMergeCells mergeCells = workSheet.getMergeCells();
SheetData sheetData = workSheet.getSheetData();
List<ArrayList<Row>> rowGroups = new ArrayList<ArrayList<Row>>();
List<CTMergeCell> cTMergeCells = mergeCells.getMergeCell();
for(CTMergeCell mcells : cTMergeCells){
String range = mcells.getRef();
Integer rowStart = Integer.parseInt(range.substring(1, 2));
Integer rowEnd = Integer.parseInt(range.substring(4, 5));
ArrayList<Row> rowss = (ArrayList<Row>) sheetData.getRow().stream().filter(row -> {
return row.getR() >= rowStart.longValue() && row.getR() <= rowEnd.longValue();
}).collect(Collectors.toList());
rowGroups.add((ArrayList<Row>) rowss);
}