aspose file tools*
The moose likes Java in General and the fly likes sheet.getLastRowNum() returns -1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "sheet.getLastRowNum() returns -1" Watch "sheet.getLastRowNum() returns -1" New topic
Author

sheet.getLastRowNum() returns -1

aadesh dongre
Greenhorn

Joined: Dec 01, 2010
Posts: 2
String filename = "D:\\PersonalValuesAssets.xlsx";


FileInputStream fis = null;
fis = new FileInputStream(filename);
XSSFWorkbook workbook = new XSSFWorkbook(fis);
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator rows=null;
rows = sheet.rowIterator();

int number=sheet.getLastRowNum();

System.out.println(" number of rows: "+ number);

Here, number returns -1 as the .xlsx file currently have more than 1.5 lakhs records.
To execute this program I had also increases the heap size using the VM parameters to min 512 MB ans max to 1280 MB.

Please help me to out from this thing...

Thanks in advance.
 
 
subject: sheet.getLastRowNum() returns -1