JSONArray rows = new JSONArray();
attrs.put("rs", rows);
StringAggregation styleAggregation = new StringAggregation();
StringAggregation textAggregation = new StringAggregation();
MergeAggregation mergeAggregation = new MergeAggregation(getMergeMatrixHelper(sheet));
for (int row = top; row <= bottom; row++) {
JSONObject r = getRowAttrs(row);
rows.add(r);
JSONArray cells = new JSONArray();
r.put("cs", cells);
for (int col = left; col <= right; col++) {
cells.add(getCellAttr(sheet, type, row, col, styleAggregation, textAggregation, mergeAggregation));
}
}
attrs.put("s", textAggregation.getJSONArray());
attrs.put("st", styleAggregation.getJSONArray());
attrs.put("m", mergeAggregation.getJSONObject());
boolean addRowColumnHeader = containsHeader == Header.BOTH;
boolean addRowHeader = addRowColumnHeader || containsHeader == Header.ROW;
boolean addColumnHeader = addRowColumnHeader || containsHeader == Header.COLUMN;