I have an example of accessing a cell in a Java POI worksheet:
我有一个访问Java POI工作表中的单元格的示例:
CellReference cr = new CellReference("A1");
row = mySheet.getRow(cr.getRow());
cell = row.getCell(cr.getCol());
but now if I need the next cell in a row or another cell in another row, is there an easy way to navigate about the worksheet? Is there some type of increment function?
但是现在,如果我需要连续的下一个单元格或另一行中的另一个单元格,是否有一种简单的方法来浏览工作表?是否有某种类型的增量函数?
3 个解决方案
#1
0
There should be an iterator of some sort. In an older version of POI it was something like this: Iterator rowIterator = sheet.rowIterator(); while (rowIterator.hasNext()) { Row R = rowIterator.next(); Cell cell = R.getCell(1); }
应该有某种迭代器。在较旧版本的POI中,它是这样的:Iterator rowIterator = sheet.rowIterator(); while(rowIterator.hasNext()){Row R = rowIterator.next(); Cell cell = R.getCell(1); }
#2
0
In the Javadoc of HSSFRow there is an iterator() function however it is for the physically defined cells.
在HSSFRow的Javadoc中有一个iterator()函数,但它适用于物理定义的单元格。
#3
0
cr.getRow() and cr.getCol() are int so they can be incremented to return the necessary cell
cr.getRow()和cr.getCol()是int,因此可以递增它们以返回必要的单元格
#1
0
There should be an iterator of some sort. In an older version of POI it was something like this: Iterator rowIterator = sheet.rowIterator(); while (rowIterator.hasNext()) { Row R = rowIterator.next(); Cell cell = R.getCell(1); }
应该有某种迭代器。在较旧版本的POI中,它是这样的:Iterator rowIterator = sheet.rowIterator(); while(rowIterator.hasNext()){Row R = rowIterator.next(); Cell cell = R.getCell(1); }
#2
0
In the Javadoc of HSSFRow there is an iterator() function however it is for the physically defined cells.
在HSSFRow的Javadoc中有一个iterator()函数,但它适用于物理定义的单元格。
#3
0
cr.getRow() and cr.getCol() are int so they can be incremented to return the necessary cell
cr.getRow()和cr.getCol()是int,因此可以递增它们以返回必要的单元格