-2
我想通过删除第一行和第一列来读取excel表。我可以消除第一行,但不能消除第一列。 apache poi中没有任何函数来获取列号或单元格号。有没有其他方法可以做到这一点?在java中使用apache poi消除excel表的第一列
我想通过删除第一行和第一列来读取excel表。我可以消除第一行,但不能消除第一列。 apache poi中没有任何函数来获取列号或单元格号。有没有其他方法可以做到这一点?在java中使用apache poi消除excel表的第一列
嗯,我想我得到了我正在寻找的东西。我使用getcolumnindex()函数来获取列索引。这样我就可以消除我希望的任何一列。
//源码
while(rows.hasNext())
{
Row nextrow = rows.next();
Iterator<Cell> cell = nextrow.cellIterator();
while (cell.hasNext())
{
Cell nextcells = cell.next();
if(nextrow.getRowNum()==0 || nextcells.getColumnIndex()==0)
{
continue; //just skip the rows if row number is 0 and column index is 0
}
else
{
//Do operation``
}
}
仅当Excel表格中的内容从第0行开始时才起作用。任何人都可以帮助我解决同样的问题,如果内容从一些随机的行和列开始? – Sathish
请告诉我们你有什么到目前为止已经试过。 –
我知道这些日子不是很流行,但[如果你阅读Apache POI文档会发生什么](http://poi.apache.org/spreadsheet/quick-guide.html#Iterator)? – Gagravarr