Merge remote-tracking branch 'upstream/feature-1.x' into feature-1.x
# Conflicts: # update.md
This commit is contained in:
commit
c11f68d207
@ -118,6 +118,8 @@ public class DataFormatter {
|
||||
*/
|
||||
private static final String invalidDateTimeString;
|
||||
|
||||
private static final BigDecimal TEN = new BigDecimal(10);
|
||||
|
||||
static {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < 255; i++) {buf.append('#');}
|
||||
@ -524,11 +526,17 @@ public class DataFormatter {
|
||||
setExcelStyleRoundingMode(df);
|
||||
Matcher endsWithCommasMatcher = endsWithCommas.matcher(pattern);
|
||||
if (endsWithCommasMatcher.find()) {
|
||||
int index_point = pattern.indexOf(".");
|
||||
int index_comma = pattern.indexOf(",");
|
||||
int cnt = index_comma - index_point - 1;
|
||||
String commas = (endsWithCommasMatcher.group(1));
|
||||
BigDecimal temp = BigDecimal.ONE;
|
||||
for (int i = 0; i < commas.length(); ++i) {
|
||||
temp = temp.multiply(ONE_THOUSAND);
|
||||
}
|
||||
for (int i = 0; i < cnt ; i++) {
|
||||
temp = temp.multiply(TEN);
|
||||
}
|
||||
divider = temp;
|
||||
} else {
|
||||
divider = null;
|
||||
|
@ -0,0 +1,13 @@
|
||||
package cn.idev.excel.test.temp.issue2319;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class Issue2319 {
|
||||
private String num1;
|
||||
private String num2;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.idev.excel.test.temp.issue2319;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
||||
import cn.idev.excel.EasyExcel;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.idev.excel.read.listener.PageReadListener;
|
||||
import cn.idev.excel.test.util.TestFileUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@Slf4j
|
||||
public class Issue2319Test {
|
||||
@Test
|
||||
public void IssueTest1() {
|
||||
String fileName = TestFileUtil.getPath() + "temp/issue2319" + File.separator + "test1.xlsx";
|
||||
FastExcel.read(fileName, Issue2319.class, new PageReadListener<Issue2319>(dataList -> {
|
||||
for (Issue2319 issueData : dataList) {
|
||||
System.out.println(("读取到一条数据{}" + JSON.toJSONString(issueData)));
|
||||
}
|
||||
})).sheet().doRead();
|
||||
}
|
||||
|
||||
//CS304 (manually written) Issue link: https://github.com/alibaba/easyexcel/issues/2319
|
||||
@Test
|
||||
public void IssueTest2() {
|
||||
String fileName = TestFileUtil.getPath() + "temp/issue2319" + File.separator + "test2.xlsx";
|
||||
FastExcel.read(fileName, Issue2319.class, new PageReadListener<Issue2319>(dataList -> {
|
||||
for (Issue2319 issueData : dataList) {
|
||||
System.out.println(("读取到一条数据{}" + JSON.toJSONString(issueData)));
|
||||
}
|
||||
})).sheet().doRead();
|
||||
}
|
||||
}
|
BIN
fastexcel-test/src/test/resources/temp/issue2319/test1.xlsx
Normal file
BIN
fastexcel-test/src/test/resources/temp/issue2319/test1.xlsx
Normal file
Binary file not shown.
BIN
fastexcel-test/src/test/resources/temp/issue2319/test2.xlsx
Normal file
BIN
fastexcel-test/src/test/resources/temp/issue2319/test2.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user