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 2016/11/18 06:53:37 UTC

[Bug 60389] New: XSSFSheet getLastRowNum return strange value

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

            Bug ID: 60389
           Summary: XSSFSheet getLastRowNum return strange value
           Product: POI
           Version: 3.15-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: tuyenivt@gmail.com
  Target Milestone: ---

When i get last row of sheet, getLastRowNum return last row formated instead
last row has data.
Have another way to get last row have data?
Thank you very much for reading and support.

-- 
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 60389] XSSFSheet getLastRowNum return strange value

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

--- Comment #1 from Zero <tu...@gmail.com> ---
Created attachment 34459
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34459&action=edit
excel formated last row

excel file added formated last row (1048576) as currency (decimal: 0; symbol:
$)

test code:
@Test
public void testGetLastRowNum() throws IOException {
  String filePath = "test-data/60389_get_last_row_num.xlsx";
  try (XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(filePath))) {
    XSSFSheet sheet = wb.getSheetAt(0);
    System.out.println(sheet.getLastRowNum());
  }
}

-- 
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 60389] XSSFSheet getLastRowNum return strange value

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

--- Comment #3 from Zero <tu...@gmail.com> ---
Thank you very much, Javen O'Neal

-- 
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 60389] XSSFSheet getLastRowNum return strange value

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #2 from Javen O'Neal <on...@apache.org> ---
getLastRowNum returns the row number of the last physical row in the sheet.
This is equivalent to Ctrl+Down in Excel

The Sheet interface doesn't have a function to get the last row containing at
least one non-blank cell.

You will need to iterate over the rows (ideally a reverse iterator) and iterate
over cells in each row to determine if that row is blank, then return the row
number of the last non-blank row. This sounds like it could be expensive.

You may want to look at
http://stackoverflow.com/questions/38204944/apache-poi-check-if-a-column-is-empty/38238218#38238218
for ideas on efficient iteration.

Since this is not a bug but a usage question, I. If you have more questions,
please ask them on user@poi.apache.org mailing list.
https://poi.apache.org/mailinglists.html

-- 
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