You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/08/17 01:15:12 UTC

svn commit: r1903471 - /poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Author: fanningpj
Date: Wed Aug 17 01:15:12 2022
New Revision: 1903471

URL: http://svn.apache.org/viewvc?rev=1903471&view=rev
Log:
[bug-66215] try to improve logic for overlapping tables

Modified:
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1903471&r1=1903470&r2=1903471&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Wed Aug 17 01:15:12 2022
@@ -3044,7 +3044,10 @@ public class XSSFSheet extends POIXMLDoc
     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);
             }
         }
@@ -3082,7 +3085,10 @@ public class XSSFSheet extends POIXMLDoc
     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);
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org