• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

poi read some cell err problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic