You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2019/09/15 10:11:59 UTC

[Bug 63749] New: sheet.getLastRowNum() returns 0 when there are no rows in the sheet

https://bz.apache.org/bugzilla/show_bug.cgi?id=63749

            Bug ID: 63749
           Summary: sheet.getLastRowNum() returns 0 when there are no rows
                    in the sheet
           Product: POI
           Version: 3.17-FINAL
          Hardware: Macintosh
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: nathan.kim@workday.com
  Target Milestone: ---

When there are no rows created in the sheet, sheet.getLastRowNum() returns 0
but when there is 1 row created, sheet.getLastRowNum() also returns 0.
Shouldn't sheet.getLastRowNum() return -1 for sheet that has no rows?

This is causing issues when you try to create a new row based on the last row
number. Due to the above issue, the first row that gets created will start from
the 2nd row instead of the very top.

private Row row;

    public void createRow() {
        row = sheet.createRow(sheet.getLastRowNum() + 1);
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63749] sheet.getLastRowNum() returns 0 when there are no rows in the sheet

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63749

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
This would affect other methods as well, e.g. Sheet.getFirstRowNum().

Row.getFirstCellNum() and Row.getLastCellNum() already return -1 in this case.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 63749] sheet.getLastRowNum() returns 0 when there are no rows in the sheet

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63749

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
With r1871589 we now return -1 in all getFirstRow/getFirstColumn calls in all
three implementations (HSSF, XSSF, SXSSF) and thus should be consistent in how
this is handled.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org