Hi, I m using poi1.8-dev and my java version is 1.1.3_04. I m using poi to read and append to mid size excel files(around 2 MB) containing several sheets. After around 30th row it returns a null through I can see in the file that the row is populated. The running code which i use is below. I m attaching the XL file as well. Thanx Amitabh -------------------------------------------------------------------------- import java.io.*; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import java.util.Vector; import java.util.Iterator; public class SkuReadTest18 { public SkuReadTest18() { } public static void main(String args[]) throws IOException { POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("C:\\tc30 \\tstlocdir\\TestExcel.xls")); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet; HSSFRow row; HSSFRow r; HSSFCell cell; HSSFCell cell1; HSSFCell parcell; String xxx; int j=0; int i; int celltype,k ; String yyy; int shtno = wb.getNumberOfSheets(); Vector vec = new Vector(500); System.out.println("The number of sheets is " + shtno); for ( i = 0; i <shtno; i++) { try { sheet = wb.getSheetAt(i); row = sheet.getRow(2); cell = row.getCell((short)0); celltype = cell.getCellType(); System.out.println("cell type is " + celltype); if (celltype==1) { xxx = cell.getStringCellValue().toString(); System.out.println("The Parent value is "+ xxx); cell1 =null; if (xxx.equals("PARENT_PART_NUM")) { Iterator rows = sheet.rowIterator(); r = (HSSFRow)rows.next(); while(r.getRowNum()<3) r = (HSSFRow)rows.next(); j=3; while(rows.hasNext()) { r = (HSSFRow)rows.next(); cell1 = r.getCell((short)0); if (cell1!=null) { yyy = cell1.getStringCellValue(); System.out.println("yyy at j =" +j + "is .."+ yyy); if (yyy.length()>0) { if(!vec.contains(yyy)) vec.add(yyy); } } j++; } } } }catch (Exception e) { e.printStackTrace(); }//else continue; System.out.println("The Vector is "+vec.size()); } } }
Created attachment 4527 [details] Test XL file
The excel version is excel-2000.
submit a simpler runnable .java file and attach it. (then you can reopen)