Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

poi read some cell err problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!