From e7f6bc6b74bc75e4c4b66f8451e932ec856b64c1 Mon Sep 17 00:00:00 2001 From: Vitalii Ananev Date: Tue, 25 Jan 2022 23:23:22 +0300 Subject: [PATCH] fix converting cell number value to string --- .../table_wrapper/excel/ExcelCellDataAccessObject.java | 10 ++++++++++ 1 file changed, 10 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 798f7b1..277702f 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 @@ -47,6 +47,16 @@ public Object getValue(Cell cell) { }; } + @Override + public String getStringValue(Cell cell) { + Object value = getValue(cell); + String strValue = value.toString(); + if ((value instanceof Number) && strValue.endsWith(".0")) { + return strValue.substring(0, strValue.length() - 2); + } + return strValue; + } + @Override public Instant getInstantValue(Cell cell) { return cell.getDateCellValue().toInstant();