Hi,
I worked on this...But i didn't phase any problems.
Please go through the code let me know any doubts.
File filename = new File(filename1);
FileInputStream fin = new FileInputStream(filename);
HSSFWorkbook wb = new HSSFWorkbook(fin);
HSSFSheet sheet = wb.getSheetAt(sheetno);
Iterator rows = sheet.rowIterator();
HSSFRow r = (HSSFRow)rows.next();
while(r.getRowNum()<4)
r = (HSSFRow)rows.next();
rownum = r.getRowNum();
FileOutputStream fileout = new
FileOutputStream(filename);
HSSFCell cell;
HSSFCellStyle cs = wb.createCellStyle();
HSSFFont f2 = wb.createFont();
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(2);
int dot;
r = sheet.createRow((short)(rownum+i));
cell = r.createCell((short)col);
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
cell.setCellValue(xlval);
wb.write(fileout);
fileout.close();
Regards
kalpana.k
Amitabh Verma wrote:
> Hi there,
> I m using poi to read and append to mid size excel
> files(around 2 MB) containing several sheets.
> The following is the part of the code I use.
> ----------------------------------
> for ( j =3;j<500; j++)
> {
> rowx = sheet.getRow(j);
> if (rowx ==null) continue;
> cell = rowx.getCell((short)6);
> if (cell!=null)
> {
> yyy = cell.getStringCellValue();
> -- some processing --
> }
> }
> ---------------------------------------
> After around 30th row the "rowx = sheet.getRow(j)"
> returns a null through I can see in the file that the
> row is populated.
> Now when create another XL file(which has 2 sheets in
> all) by copying the same sheet it works fine.
> Has any one faced this before.
>
> Thanx and Regards
> Amitabh
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail: <mailto:poi-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:poi-user-help@jakarta.apache.org>
|