Skip to content

Commit a245bc4

Browse files
authored
Cell.getText in a Numeric Cell returns numeric with .0 in integer values (#567)
Issue: 96206
1 parent dcad09d commit a245bc4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

gxoffice/src/main/java/com/genexus/gxoffice/poi/hssf/ExcelCells.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.genexus.CommonUtil;
1919
import com.genexus.gxoffice.IExcelCells;
2020
import com.genexus.gxoffice.IGxError;
21+
import org.apache.poi.ss.util.NumberToTextConverter;
2122

2223
/**
2324
* @author Diego
@@ -209,7 +210,7 @@ else if (pCells[1].getCellType() == CellType.NUMERIC) {
209210
if (DateUtil.isCellDateFormatted(pCells[1])) {
210211
return pCells[1].getDateCellValue().toString();
211212
} else {
212-
return Double.toString(pCells[1].getNumericCellValue());
213+
return NumberToTextConverter.toText(pCells[1].getNumericCellValue());
213214
}
214215
} else
215216
return pCells[1].getStringCellValue();

gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelCells.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.apache.poi.ss.usermodel.Font;
1414
import org.apache.poi.ss.usermodel.Row;
1515
import org.apache.poi.ss.usermodel.Workbook;
16+
import org.apache.poi.ss.util.NumberToTextConverter;
1617
import org.apache.poi.xssf.usermodel.XSSFCell;
1718
import org.apache.poi.xssf.usermodel.XSSFColor;
1819
import org.apache.poi.xssf.usermodel.XSSFFont;
@@ -209,7 +210,7 @@ else if (pCells[1].getCellType() == CellType.NUMERIC) {
209210
if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(pCells[1])) {
210211
return pCells[1].getDateCellValue().toString();
211212
} else {
212-
return Double.toString(pCells[1].getNumericCellValue());
213+
return NumberToTextConverter.toText(pCells[1].getNumericCellValue());
213214
}
214215
} else
215216
return pCells[1].getStringCellValue();

0 commit comments

Comments
 (0)