[英]Iterate through a specific range of rows in java (apache poi)
Right now I'm iterating through all rows and finding the index, then if the index is within bounds, I do something with it 现在,我要遍历所有行并找到索引,然后如果索引在范围之内,我会对其进行操作
for (Row r: sheet) {
if(r.getRowNum()>x)
Cell cell = r.getCell(1);
something something something
}
But is there a way to iterate through a specific range without having to go through the comparison? 但是有没有一种方法可以遍历特定范围而不必进行比较?
A HSSFSheet
object has a getRow(int index)
method you can use to retrieve any row. HSSFSheet
对象具有getRow(int index)
方法,可用于检索任何行。
for (int i=start_row; i<=end_row; i++)
{
HSSFRow = sheet.getRow(i);
something something something
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.