]> source.dussan.org Git - poi.git/commitdiff
Bug 50319: Make row groups which include row 0 work
authorDominik Stadler <centic@apache.org>
Tue, 29 Sep 2015 12:26:08 +0000 (12:26 +0000)
committerDominik Stadler <centic@apache.org>
Tue, 29 Sep 2015 12:26:08 +0000 (12:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1705844 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java

index 16bc38598412443325929209ea92a982e9d72b8c..ea1846a384e337a2651f2f2a1765e82b102547e9 100644 (file)
@@ -293,7 +293,7 @@ public final class RowRecordsAggregate extends RecordAggregate {
                RowRecord rowRecord = this.getRow( row );
                int level = rowRecord.getOutlineLevel();
                int currentRow = row;
-               while (this.getRow( currentRow ) != null) {
+               while (currentRow >= 0 && this.getRow( currentRow ) != null) {
                        rowRecord = this.getRow( currentRow );
                        if (rowRecord.getOutlineLevel() < level) {
                                return currentRow + 1;
index fa9f70f66b5336558957118ae18d652f47258ae8..eff708ee009666482f0bcc12eb831da50438b947 100644 (file)
@@ -1274,4 +1274,18 @@ public abstract class BaseTestBugzillaIssues {
 
         wb.close();
     }
+
+    @Test
+    public void test50319() throws IOException {
+        Workbook wb = new HSSFWorkbook();
+        Sheet sheet = wb.createSheet("Test");
+        sheet.createRow(0);
+        sheet.groupRow(0, 0);
+        sheet.setRowGroupCollapsed(0, true);
+        
+        sheet.groupColumn(0, 0);
+        sheet.setColumnGroupCollapsed(0, true);
+        
+        wb.close();
+    }
 }