poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1819404 - in /poi/trunk/src/ooxml: java/org/apache/poi/xssf/usermodel/XSSFRow.java java/org/apache/poi/xssf/usermodel/XSSFSheet.java testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
Date Thu, 28 Dec 2017 08:45:43 GMT
Author: centic
Date: Thu Dec 28 08:45:43 2017
New Revision: 1819404

URL: http://svn.apache.org/viewvc?rev=1819404&view=rev
Log:
Bug 61798: Fix usage of getLastCellNum(), unfortunately this is a bit misleading compared
to getFirstCellNum()...

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java?rev=1819404&r1=1819403&r2=1819404&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java Thu Dec 28 08:45:43
2017
@@ -266,7 +266,7 @@ public class XSSFRow implements Row, Com
     }
 
     /**
-     * Get the number of the first cell contained in this row.
+     * Get the 0-based number of the first cell contained in this row.
      *
      * @return short representing the first logical cell in the row,
      *  or -1 if the row does not contain any cells.

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1819404&r1=1819403&r2=1819404&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Thu Dec 28 08:45:43
2017
@@ -3492,9 +3492,9 @@ public class XSSFSheet extends POIXMLDoc
                 // Resetting the hyperlink array seems to break some XML nodes.
                 //worksheet.getHyperlinks().setHyperlinkArray(new CTHyperlink[0]);
                 worksheet.unsetHyperlinks();
-            } else {
+            } /*else {
                 // nothing to do
-            }
+            }*/
         }
 
         int minCell=Integer.MAX_VALUE, maxCell=Integer.MIN_VALUE;
@@ -3507,7 +3507,7 @@ public class XSSFSheet extends POIXMLDoc
                 minCell = Math.min(minCell, row.getFirstCellNum());
             }
             if(row.getLastCellNum() != -1) {
-                maxCell = Math.max(maxCell, row.getLastCellNum());
+                maxCell = Math.max(maxCell, row.getLastCellNum()-1);
             }
         }
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1819404&r1=1819403&r2=1819404&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Thu Dec
28 08:45:43 2017
@@ -3102,6 +3102,8 @@ public final class TestXSSFBugs extends
         Cell cell = row.createCell(1);
         cell.setCellValue("blabla");
 
+        //0 1 2 3 4 5 6 7
+        //A B C D E F G H
         row = sheet.createRow(4);
         cell = row.createCell(7);
         cell.setCellValue("blabla");
@@ -3110,7 +3112,29 @@ public final class TestXSSFBugs extends
         // to avoid having to iterate all rows/cells in each add/remove of a row or cell
         wb.write(new NullOutputStream());
 
-        assertEquals("B2:I5", ((XSSFSheet) sheet).getCTWorksheet().getDimension().getRef());
+        assertEquals("B2:H5", ((XSSFSheet) sheet).getCTWorksheet().getDimension().getRef());
+
+        wb.close();
+    }
+
+    @Test
+    public void test61798() throws IOException {
+        Workbook wb = new XSSFWorkbook();
+        Sheet sheet = wb.createSheet("test");
+        Row row = sheet.createRow(1);
+        Cell cell = row.createCell(1);
+        cell.setCellValue("blabla");
+
+        row = sheet.createRow(4);
+        // Allowable column range for EXCEL2007 is (0..16383) or ('A'..'XDF')
+        cell = row.createCell(16383);
+        cell.setCellValue("blabla");
+
+        // we currently only populate the dimension during writing out
+        // to avoid having to iterate all rows/cells in each add/remove of a row or cell
+        wb.write(new NullOutputStream());
+
+        assertEquals("B2:XFD5", ((XSSFSheet)sheet).getCTWorksheet().getDimension().getRef());
 
         wb.close();
     }



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


Mime
View raw message