-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