I use jdk1.4.0_1 & eclipse & window2000 system
I run bigexample.java generate workbook.xls
but I read it
why can't read it (Some cells j=2 )
Can you give me some guid!!
//sht is HSSFSheet , row is HSSFRow
for (int j = 0; j < 5; j++) {
row = sht.getRow(j);
inner:
for (short i = 0; i < 6; i++) {
cell = row.getCell((short) i);
if(cell==null)
{
System.out.println("j="+j+ " i="+i);
continue inner;
}
int ctyp = cell.getCellType();
switch (ctyp) {
case HSSFCell.CELL_TYPE_FORMULA :
String strformula = cell.getCellFormula();
//FormulaParser fparser=new FormulaParser(strformula,row.);
System.out.println("formula=" + strformula);
break;
case HSSFCell.CELL_TYPE_NUMERIC :
System.out.println(
"numeric=" + cell.getNumericCellValue());
break;
case HSSFCell.CELL_TYPE_STRING :
System.out.println(
"string=" + cell.getStringCellValue());
break;
case HSSFCell.CELL_TYPE_BOOLEAN :
System.out.println(
"boolean=" + cell.getBooleanCellValue());
break;
case HSSFCell.CELL_TYPE_ERROR :
System.out.println("err=" + cell.getErrorCellValue());
break;
default :
case HSSFCell.CELL_TYPE_BLANK :
System.out.println("");
}
}
}
/** result
numeric=0.0
string=TEST
numeric=2.0002
string=TEST
numeric=4.0004
string=TEST
numeric=10000.001
string=TEST
numeric=10002.0012
string=TEST
numeric=10004.0014
string=TEST
j=2 i=0
j=2 i=1
j=2 i=2
j=2 i=3
j=2 i=4
j=2 i=5
numeric=30000.003
string=TEST
numeric=30002.0032
string=TEST
numeric=30004.0034
string=TEST
numeric=40000.004
string=TEST
numeric=40002.0042
string=TEST
numeric=40004.0044
string=TEST