Browse Source

修复在读取值的时候读取了额外值导致数据转换异常

pull/561/head
Jiaju Zhuang 5 years ago
parent
commit
0a3dd0fe6b
  1. 2
      .github/ISSUE_TEMPLATE/question.md
  2. 3
      src/main/java/com/alibaba/excel/analysis/v07/handlers/DefaultCellHandler.java
  3. 2
      src/test/java/com/alibaba/easyexcel/test/temp/simple/HgTest.java
  4. 3
      update.md

2
.github/ISSUE_TEMPLATE/question.md

@ -12,5 +12,5 @@ assignees: ''
这里写你的代码 这里写你的代码
``` ```
**异常提示** **异常提示**
请提供完整的异常提示 请提供完整的异常提示,记住是全部异常!
**建议描述** **建议描述**

3
src/main/java/com/alibaba/excel/analysis/v07/handlers/DefaultCellHandler.java

@ -148,6 +148,9 @@ public class DefaultCellHandler implements XlsxCellHandler, XlsxRowResultHolder
currentCellData.setFormulaValue(currentCellValue); currentCellData.setFormulaValue(currentCellValue);
return; return;
} }
if (!CELL_VALUE_TAG.equals(currentTag) && !CELL_INLINE_STRING_VALUE_TAG.equals(currentTag)) {
return;
}
CellDataTypeEnum oldType = currentCellData.getType(); CellDataTypeEnum oldType = currentCellData.getType();
switch (oldType) { switch (oldType) {
case DIRECT_STRING: case DIRECT_STRING:

2
src/test/java/com/alibaba/easyexcel/test/temp/simple/HgTest.java

@ -24,7 +24,7 @@ public class HgTest {
@Test @Test
public void hh() throws IOException { public void hh() throws IOException {
List<Object> list = List<Object> list =
EasyExcel.read(new FileInputStream("D:\\test\\原文件.xlsx")).headRowNumber(0).sheet().doReadSync(); EasyExcel.read(new FileInputStream("D:\\test\\20190906192340.xlsx")).headRowNumber(0).sheet().doReadSync();
for (Object data : list) { for (Object data : list) {
LOGGER.info("返回数据:{}", JSON.toJSONString(data)); LOGGER.info("返回数据:{}", JSON.toJSONString(data));
} }

3
update.md

@ -1,3 +1,6 @@
# 2.0.0-beta5
* 修复在读取值的时候读取了额外值导致数据转换异常
# 2.0.0-beta4 # 2.0.0-beta4
* 修改在传入List<List<Object>>判断行数错误 [Issue #526](https://github.com/alibaba/easyexcel/issues/526) * 修改在传入List<List<Object>>判断行数错误 [Issue #526](https://github.com/alibaba/easyexcel/issues/526)
* 修复在mac 2016 2017导出的excel 可能存在多余字段的问题 * 修复在mac 2016 2017导出的excel 可能存在多余字段的问题

Loading…
Cancel
Save