You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2003/01/24 05:26:31 UTC
DO NOT REPLY [Bug 16381] New: -
getRow returning null even when populated rows are present.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16381>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16381
getRow returning null even when populated rows are present.
Summary: getRow returning null even when populated rows are
present.
Product: POI
Version: 2.0-dev
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: HSSF
AssignedTo: poi-dev@jakarta.apache.org
ReportedBy: vermaamitabh@yahoo.com
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());
}
}
}