poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1749248 - in /poi/trunk/src: java/org/apache/poi/hssf/usermodel/HSSFSheet.java ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java
Date Mon, 20 Jun 2016 02:02:09 GMT
Author: onealj
Date: Mon Jun 20 02:02:08 2016
New Revision: 1749248

URL: http://svn.apache.org/viewvc?rev=1749248&view=rev
Log:
bug 56454: keep XSSFRowShifter#shiftMerged in sync with HSSFSheet: when shifting rows, shift
merged regions (even when the merged region does not include column 0)

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=1749248&r1=1749247&r2=1749248&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Mon Jun 20 02:02:08 2016
@@ -1484,6 +1484,7 @@ public final class HSSFSheet implements
      * @param startRow the start-index of the rows to shift, zero-based
      * @param endRow the end-index of the rows to shift, zero-based
      * @param n how far to shift, negative to shift up
+     * This should be kept in sync with {@link org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter#shiftMerged(int,
int, int)}
      */
     private void shiftMerged(int startRow, int endRow, int n) {
         List<CellRangeAddress> shiftedRegions = new ArrayList<CellRangeAddress>();

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java?rev=1749248&r1=1749247&r2=1749248&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFRowShifter.java Mon
Jun 20 02:02:08 2016
@@ -69,6 +69,8 @@ public final class XSSFRowShifter {
      * @param endRow   the row to end shifting
      * @param n        the number of rows to shift
      * @return an array of affected cell regions
+     * 
+     * This should be kept in sync with {@link org.apache.poi.hssf.usermodel.HSSFSheet#shiftMerged(int,
int, int)}
      */
     public List<CellRangeAddress> shiftMerged(int startRow, int endRow, int n) {
         List<CellRangeAddress> shiftedRegions = new ArrayList<CellRangeAddress>();
@@ -87,7 +89,7 @@ public final class XSSFRowShifter {
             }
 
             //only shift if the region outside the shifted rows is not merged too
-            if (!containsCell(merged, startRow - 1, 0) && !containsCell(merged, endRow
+ 1, 0)) {
+            if (!merged.containsRow(startRow - 1) && !merged.containsRow(endRow +
1)) {
                 merged.setFirstRow(merged.getFirstRow() + n);
                 merged.setLastRow(merged.getLastRow() + n);
                 //have to remove/add it back



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


Mime
View raw message