Thank Microsoft for that, I claim to have had nothing to do with that. :) Cheers!
On Wed, 2016-08-17 at 13:17 +0200, Gregor Kovač wrote: > Hi! > > > I know that rows are 0 based, but I didn't know that there can actually be > physically missing rows. Thanks for that. :) > > Best regards, > Kovi > > > 2016-08-17 13:13 GMT+02:00 Andreas Reichel <andreas@manticore-project s.com>: > > > Your program is correct! 19th row is in 20th line :) > > Line 20 has no row. Sheet.getRow(19)==null! Rows and Cell can be > > physically empty! > > > > try { > > File file = new > > File("/home/gregor/tmp/smyk/LIVE4/POI_TEST.xls"); > > fis = new > > FileInputStream(file); > > Workbook workBook = new > > HSSFWorkbook(fis); > > int activeSheet = > > workBook.getActiveSheetIndex(); > > Sheet sheet1 = > > workBook.getSheetAt(activeSheet); > > int r=0; > > for > > (Row row : sheet1) { > > r++; > > > > System.out.println("Row" + r + " shows at Line #" + > > (row.getRowNum() + 1)); > > } > > } catch (Exception e) { > > e.printStackTrace(); > > } finally { > > if (fis != null) { > > try { > > fis.close(); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > > > On Wed, 2016-08-17 at 13:09 +0200, Gregor Kovač wrote: > > > Hi! > > > > > > > > > > > Can you please give me a corrected program that I sent in first e- > > mail? > > > > > > Best regards, > > > Kovi > > > > > > > > > > > 2016-08-17 12:47 GMT+02:00 Andreas Reichel <andreas@manticore-p roject > > s.com>: > > > > > > > Gregor, > > > > > > > > Rows and Cell are shown in Excel, even when not there (meaning > > > > Row==Null or Cell==Null). > > > > Your need to create a row first and the populate it with cells. > > > > > > > > Best regards > > > > > > > > On Wed, 2016-08-17 at 12:40 +0200, Gregor Kovač wrote: > > > > > Hi! > > > > > > > > > > > > > > > > > > > > I have an Excel file for which POI does > > > > > > > > > > > > > > > > > > > > not return all > > rows. > > The file > > > > is in attachment. > > > > > I have tried with POI 3.11 and 3.15beta2 with same results. > > > > > Program I use: > > > > > FileInputStream fis = null; > > > > > > > > > > try { > > > > > > File file = new > > > > File("/home/gregor/tmp/smyk/LIVE4/POI_TEST.xls"); > > > > > fis = new FileInputStream(file); > > > > > Workbook workBook = new HSSFWorkbook(fis); > > > > > int activeSheet = workBook.getActiveSheetIndex(); > > > > > Sheet sheet1 = workBook.getSheetAt(activeSheet); > > > > > > > > > > for (Row row : sheet1) { > > > > > > > > > > System.out.println("#" + (row.getRowNum() + 1)); > > > > > } > > > > > } catch (Exception e) { > > > > > e.printStackTrace(); > > > > > } finally { > > > > > if (fis != null) { > > > > > try { > > > > > fis.close(); > > > > > } catch (Exception e) { > > > > > e.printStackTrace(); > > > > > } > > > > > } > > > > > } > > > > > > > > > > > > > > > > > > > > Output I get: > > > > > #1 > > > > > #2 > > > > > #3 > > > > > #4 > > > > > #5 > > > > > #6 > > > > > #7 > > > > > #8 > > > > > #9 > > > > > #10 > > > > > #11 > > > > > #12 > > > > > #13 > > > > > #14 > > > > > #15 > > > > > #16 > > > > > #17 > > > > > #18 > > > > > #20 > > > > > #21 > > > > > #22 > > > > > #23 > > > > > > > > > > > > > > > > > > > > > > As you can see #19 is missing and if I open the Excel > > > > > > > > > > > > file in > > > > LibreOffice or Excel I see row 19. > > > > > Why does POI not return it? > > > > > > > > > > Best regards, > > > > > Kovi > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ----------------------------------------------------- ------- > > --- > > ------ > > > > > To unsubscribe, e-mail: user-unsubscr...@poi.apache.org > > > > > For additional commands, e-mail: user-h...@poi.apache.org > > > > > > > > > > > > > > > > > >