|
|
|
@ -7,6 +7,7 @@ import com.alibaba.excel.enums.CellDataTypeEnum;
|
|
|
|
|
import com.alibaba.excel.metadata.CellData; |
|
|
|
|
import com.alibaba.excel.read.metadata.holder.xlsx.XlsxReadSheetHolder; |
|
|
|
|
import com.alibaba.excel.util.BooleanUtils; |
|
|
|
|
import com.alibaba.excel.util.StringUtils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Cell Value Handler |
|
|
|
@ -20,6 +21,7 @@ public abstract class AbstractCellValueTagHandler extends AbstractXlsxTagHandler
|
|
|
|
|
XlsxReadSheetHolder xlsxReadSheetHolder = xlsxReadContext.xlsxReadSheetHolder(); |
|
|
|
|
CellData tempCellData = xlsxReadSheetHolder.getTempCellData(); |
|
|
|
|
StringBuilder tempData = xlsxReadSheetHolder.getTempData(); |
|
|
|
|
String tempDataString = tempData.toString(); |
|
|
|
|
CellDataTypeEnum oldType = tempCellData.getType(); |
|
|
|
|
switch (oldType) { |
|
|
|
|
case DIRECT_STRING: |
|
|
|
@ -28,10 +30,18 @@ public abstract class AbstractCellValueTagHandler extends AbstractXlsxTagHandler
|
|
|
|
|
tempCellData.setStringValue(tempData.toString()); |
|
|
|
|
break; |
|
|
|
|
case BOOLEAN: |
|
|
|
|
if(StringUtils.isEmpty(tempDataString)){ |
|
|
|
|
tempCellData.setType(CellDataTypeEnum.EMPTY); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
tempCellData.setBooleanValue(BooleanUtils.valueOf(tempData.toString())); |
|
|
|
|
break; |
|
|
|
|
case NUMBER: |
|
|
|
|
case EMPTY: |
|
|
|
|
if(StringUtils.isEmpty(tempDataString)){ |
|
|
|
|
tempCellData.setType(CellDataTypeEnum.EMPTY); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
tempCellData.setType(CellDataTypeEnum.NUMBER); |
|
|
|
|
tempCellData.setNumberValue(new BigDecimal(tempData.toString())); |
|
|
|
|
break; |
|
|
|
|