java Poi 操做執行excel 文件中函數問題

poi 讀取excel 文件,當excel 有函數時,poi直接讀取返回的是excel 函數,並不能返回函數計算結果:函數

解決步驟:excel

sheet.setForceFormulaRecalculation(true);

判斷該列格式是否爲函數,爲函數直接getNumericCellValue()可獲取計算結果code

Cell cell = row.getCell(gCellName);
             if(cell.getCellType()==CellType.FORMULA){
                double result = cell1.getNumericCellValue();
            }

若是excel 數據量小時 excel 讀取時間不影響,數據量大時,讀取excel 時間會有些長。orm

 

 

https://www.aliyun.com/acts/limit-buy?userCode=b2pqtlkqblog

相關文章
相關標籤/搜索