Browse Source

Merge pull request #1787 from jaaaar/master

fix.处理空值不受指定converter处理的问题
pull/1198/head^2
Jiaju Zhuang 4 years ago committed by GitHub
parent
commit
a369e7ec87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/main/java/com/alibaba/excel/write/executor/AbstractExcelWriteExecutor.java

6
src/main/java/com/alibaba/excel/write/executor/AbstractExcelWriteExecutor.java

@ -33,9 +33,6 @@ public abstract class AbstractExcelWriteExecutor implements ExcelWriteExecutor {
protected CellData<?> converterAndSet(WriteHolder currentWriteHolder, Class<?> clazz, CellDataTypeEnum targetType, protected CellData<?> converterAndSet(WriteHolder currentWriteHolder, Class<?> clazz, CellDataTypeEnum targetType,
Cell cell, Object value, Cell cell, Object value,
ExcelContentProperty excelContentProperty, Head head, Integer relativeRowIndex) { ExcelContentProperty excelContentProperty, Head head, Integer relativeRowIndex) {
if (value == null) {
return new CellData<>(CellDataTypeEnum.EMPTY);
}
if (value instanceof String && currentWriteHolder.globalConfiguration().getAutoTrim()) { if (value instanceof String && currentWriteHolder.globalConfiguration().getAutoTrim()) {
value = ((String)value).trim(); value = ((String)value).trim();
} }
@ -75,9 +72,6 @@ public abstract class AbstractExcelWriteExecutor implements ExcelWriteExecutor {
protected CellData<?> convert(WriteHolder currentWriteHolder, Class<?> clazz, CellDataTypeEnum targetType, protected CellData<?> convert(WriteHolder currentWriteHolder, Class<?> clazz, CellDataTypeEnum targetType,
Cell cell, Cell cell,
Object value, ExcelContentProperty excelContentProperty) { Object value, ExcelContentProperty excelContentProperty) {
if (value == null) {
return new CellData<>(CellDataTypeEnum.EMPTY);
}
// This means that the user has defined the data. // This means that the user has defined the data.
if (value instanceof CellData) { if (value instanceof CellData) {
CellData<?> cellDataValue = (CellData<?>)value; CellData<?> cellDataValue = (CellData<?>)value;

Loading…
Cancel
Save