poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47069] New: once remove all rows, HSSFSheet#getFirstRowNum() returns -1
Date Wed, 22 Apr 2009 05:44:40 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47069

           Summary: once remove all rows, HSSFSheet#getFirstRowNum()
                    returns -1
           Product: POI
           Version: 3.2-FINAL
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: rokugensai@gmail.com


for exapmle...

InputStream is = new FileInputStream("src/test/resources/Test.xls");
HSSFWorkbook wb = new HSSFWorkbook(is);
HSSFSheet sheet = wb.getSheetAt(0); // 2rows in this sheet
System.out.println(sheet.getFirstRowNum()); // 0
System.out.println(sheet.getLastRowNum());  // 1
//remove all rows
for(int i= sheet.getLastRowNum(); i >= sheet.getFirstRowNum(); i--){
    HSSFRow row = sheet.getRow(i);
    sheet.removeRow(row);
}
System.out.println(sheet.getFirstRowNum()); // -1
System.out.println(sheet.getLastRowNum());  // -1
sheet.createRow(0);
sheet.createRow(1);
System.out.println(sheet.getFirstRowNum()); // -1
System.out.println(sheet.getLastRowNum());  // 1

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


Mime
View raw message