Browse Source

Merge pull request #1929 from alibaba/bugfix

* 修复读取的时候用string接收数字 可能四舍五入不一致的bug
pull/1946/head v2.2.10
Jiaju Zhuang 4 years ago committed by GitHub
parent
commit
78bae726d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pom.xml
  2. 2
      src/main/java/com/alibaba/excel/analysis/v07/handlers/AbstractCellValueTagHandler.java
  3. 2
      src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
  4. BIN
      src/test/resources/dataformat/dataformat.xls
  5. BIN
      src/test/resources/dataformat/dataformat.xlsx
  6. 3
      update.md

2
pom.xml

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.9</version>
<version>2.2.10</version>
<packaging>jar</packaging>
<name>easyexcel</name>

2
src/main/java/com/alibaba/excel/analysis/v07/handlers/AbstractCellValueTagHandler.java

@ -43,7 +43,7 @@ public abstract class AbstractCellValueTagHandler extends AbstractXlsxTagHandler
break;
}
tempCellData.setType(CellDataTypeEnum.NUMBER);
tempCellData.setNumberValue(new BigDecimal(tempData.toString()));
tempCellData.setNumberValue(BigDecimal.valueOf(Double.parseDouble(tempDataString)));
break;
default:
throw new IllegalStateException("Cannot set values now");

2
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java

@ -34,7 +34,7 @@ public class Lock2Test {
@Test
public void test() throws Exception {
// File file = TestFileUtil.readUserHomeFile("test/test6.xls");
File file = new File("/Users/zhuangjiaju/Downloads/签到金模板-0507-v3.xlsx");
File file = new File("/Users/zhuangjiaju/test/签到金模板-0507-v5.xlsx");
List<Object> list = EasyExcel.read(file).sheet(0).headRowNumber(0).doReadSync();
LOGGER.info("数据:{}", list.size());

BIN
src/test/resources/dataformat/dataformat.xls

Binary file not shown.

BIN
src/test/resources/dataformat/dataformat.xlsx

Binary file not shown.

3
update.md

@ -1,3 +1,6 @@
# 2.2.10
* 修复读取的时候用string接收数字 可能四舍五入不一致的bug
# 2.2.9
* 修复读取的时候用string接收数字 可能四舍五入不一致的bug

Loading…
Cancel
Save