-
/*=================根据单元不同属性返回字符串数值========begin============*/
-
public String getCellStringValue(Cell cell){
-
String cellValue = "";
-
switch (CellType.forInt(cell.getCellType())){
-
case _NONE:
-
break;
-
case NUMERIC:
-
cellValue = String.valueOf(cell.getNumericCellValue());
-
break;
-
case STRING:
-
cellValue = cell.getStringCellValue();
-
if (cellValue.trim().equals("") || cellValue.trim().length() <= 0){
-
cellValue = "";
-
}
-
break;
-
case FORMULA:
-
cell.setCellType(CellType.NUMERIC);
-
cellValue = String.valueOf(cell.getNumericCellValue());
-
break;
-
case BLANK:
-
cellValue = "";
-
break;
-
case BOOLEAN:
-
break;
-
case ERROR:
-
break;
-
}
-
return cellValue;
-
}
-
/*=================根据单元不同属性返回字符串数值========end============*/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30046312/viewspace-2150663/
,如需转载,请注明出处,否则将追究法律责任。