public void shiftRows(int startRow, int endRow, final int n, boolean copyRowHeight, boolean resetOriginalRowHeight) {
List<XSSFTable> overlappingTables = new ArrayList<>();
for (XSSFTable table : getTables()) {
- if (table.getStartRowIndex() <= endRow || table.getEndRowIndex() >= startRow) {
+ if ((table.getStartRowIndex() < startRow && table.getEndRowIndex() < startRow)
+ || (table.getStartRowIndex() > endRow && table.getEndRowIndex() > endRow)) {
+ // not overlapping
+ } else {
overlappingTables.add(table);
}
}
public void shiftColumns(int startColumn, int endColumn, final int n) {
List<XSSFTable> overlappingTables = new ArrayList<>();
for (XSSFTable table : getTables()) {
- if (table.getStartColIndex() <= endColumn || table.getEndRowIndex() >= startColumn) {
+ if ((table.getStartColIndex() < startColumn && table.getEndColIndex() < startColumn)
+ || (table.getStartColIndex() > endColumn && table.getEndColIndex() > endColumn)) {
+ // not overlapping
+ } else {
overlappingTables.add(table);
}
}