2016-12-09 27 views
0
integrityrecords.get(i).get(2)="0"; 
fieldsheet.getRow(1).getCell(3) 
        .setCellValue(integrityrecords.get(i).get(2)); 
System.out.println("coulmn 1 :" + integrityrecords.get(i).get(2)); 

我想從數據庫中獲取數據作爲字符串的ArrayList,然後使用poi-3.14 XSSF將其寫入excel。 當我這樣做時,我在excel單元格中得到了警告,我在單元格中輸入一個數字值,要求「轉換爲數字」。爲了克服這個問題,我使用了setCellType()的附加代碼。XSSFCell.CELL_TYPE_NUMERIC更改值0到25

fieldsheet.getRow(integrityStartRow).getCell(3).setCellType(XSSFCell.CELL_TYPE_NUMERIC); 

當我這樣做時,單元格值更改爲25.這發生在我進入單元格的其他十進制值。

如何克服這種變化?

回答