我想读取一个电子表格的表单使用foor循环。我想知道这是读特别是用表欢迎使用属性的正确方法[代码高亮]:阅读多个Excel表格
Cell[][] newcell=new Cell[200][200];
int newsheet = workbook1.getNumberOfSheets();
for (int q=1;q < newsheet;q++)
{
for(int p=0;p < sheet(q).getColumns();p++)
{
for(int p1=0;p1<sheet(q).getRows();p1++)
/*^^^^^^^^^*/
{
newcell[p][p1] = sheet(q).getCell(p, p1);
/*^^^^^^^^^*/
if(newcell[p][p1].equals(saved[j]))
{
System.out.print(newcell[p][0]);
}
}
}
}
我可以使用表()为片(Q)的,因为它的投掷NullPointerExeption的财产?
*,其中*你得到一个NullPointerException? – 2011-05-19 09:30:58
@Andreas_D for(int p1 = 0; p1
user756742
2011-05-19 09:36:17
@ user756742 - 你的自定义'sheet(int i)'方法里面肯定有错误。 'sheet(q)'有时会返回一个对象,有时会返回'null'作为'q'的相同值 - 这不应该发生。 – 2011-05-19 09:42:50