poi excel導入整數數字自動加小數點解決


private String numberFormat(Cell cell){
		NumberFormat numberFormat = NumberFormat.getInstance();
		// 不顯示千位分割符,否則顯示結果會變成類似1,234,567,890
		numberFormat.setGroupingUsed(false);
		if (cell == null) {
			return "null";
			}
			String value = cell.toString();
			int i = cell.getCellType();
			if (i == 1) {//字符串類型
			return value;
			} else {
			value =numberFormat.format(cell.getNumericCellValue());
			return value;
			}
	}

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM