Commit c4ed7c77 by 张祺

修改excel导入数据处理空值情况

parent a529dbbd
...@@ -15,15 +15,17 @@ public class ExcelUtil { ...@@ -15,15 +15,17 @@ public class ExcelUtil {
*/ */
public static String getXSSFCellValue(XSSFCell xssfCell) { public static String getXSSFCellValue(XSSFCell xssfCell) {
String cellValue = null; String cellValue = null;
CellType cellType = xssfCell.getCellType(); if (xssfCell != null) {
if (CellType.STRING.equals(cellType)) { CellType cellType = xssfCell.getCellType();
cellValue = xssfCell.getStringCellValue(); if (CellType.STRING.equals(cellType)) {
} else if (CellType.NUMERIC.equals(cellType)) { cellValue = xssfCell.getStringCellValue();
cellValue = String.valueOf(xssfCell.getNumericCellValue()); } else if (CellType.NUMERIC.equals(cellType)) {
} else if (CellType.BOOLEAN.equals(cellType)) { cellValue = String.valueOf(xssfCell.getNumericCellValue());
cellValue = String.valueOf(xssfCell.getBooleanCellValue()); } else if (CellType.BOOLEAN.equals(cellType)) {
} else if (CellType.FORMULA.equals(cellType)) { cellValue = String.valueOf(xssfCell.getBooleanCellValue());
cellValue = String.valueOf(xssfCell.getCellFormula()); } else if (CellType.FORMULA.equals(cellType)) {
cellValue = String.valueOf(xssfCell.getCellFormula());
}
} }
return cellValue; return cellValue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment