From 165ec91791b698d276c5dd625d51b72d9688cf81 Mon Sep 17 00:00:00 2001 From: Vitalii Ananev Date: Mon, 10 Oct 2022 02:33:43 +0300 Subject: [PATCH] restore parse perf: excel stores number as double see also spacious-team/table-wrapper-api#15 --- .../table_wrapper/excel/ExcelCellDataAccessObject.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/spacious_team/table_wrapper/excel/ExcelCellDataAccessObject.java b/src/main/java/org/spacious_team/table_wrapper/excel/ExcelCellDataAccessObject.java index e5e3d7b..fd404fd 100644 --- a/src/main/java/org/spacious_team/table_wrapper/excel/ExcelCellDataAccessObject.java +++ b/src/main/java/org/spacious_team/table_wrapper/excel/ExcelCellDataAccessObject.java @@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.FormulaError; import org.spacious_team.table_wrapper.api.CellDataAccessObject; +import java.math.BigDecimal; import java.time.Instant; import java.time.LocalDateTime; @@ -38,6 +39,12 @@ public Object getValue(Cell cell) { return ExcelTableHelper.getValue(cell); } + @Override + public BigDecimal getBigDecimalValue(Cell cell) { + double number = getDoubleValue(cell); + return (Double.compare(number, 0D) == 0) ? BigDecimal.ZERO : BigDecimal.valueOf(number); + } + @Override public String getStringValue(Cell cell) { Object value = getValue(cell);