2.poi注意點

POI注意點

獲取行數和列數問題

獲取行數

無論是HSSFSheet還是XSSFSheet

sheet.getLastRowNum()//結果下標從0開始

獲取列數

無論是HSSFCell還是XSSFCell

row.getLastCellNum();//從1開始

移動行

sheet.shiftRows(int startRow,int endRow, int n)
/*
    在HSSFSheet中 n 可以爲 0,
    sheet.getRow(移動之前的行)的返回值不爲null

*/  
/*
    在XSSFSheet中 n 不可以爲 0
    sheet.getRow(移動之前的行)的返回值爲null
*/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章