优化ExcelUtil空值处理

pull/284/MERGE
Ricky 2021-04-21 09:36:21 +08:00
parent 74f3520693
commit 322c48882e
1 changed files with 4 additions and 1 deletions

View File

@ -542,9 +542,12 @@ public class ExcelUtil<T>
cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
}
else if (ColumnType.NUMERIC == attr.cellType())
{
if (StringUtils.isNotNull(value))
{
cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
}
}
else if (ColumnType.IMAGE == attr.cellType())
{
ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),