I need help about an issue that try to reading excel values as it looks. Let me explain with example,
In excel my rows with first column (mixed with string values),
10,4
10,2
11.5 //some columns using . notation
someString
When I try to read values using apache-poi
outputs: (it replaces "," with "." not wanted)
10.4
10.2
11.5
someString
it should give excatly same output. if it use ".", output should "10.4 if it use "," it should "10,4"
Even I format cells the column as text from excel, still get same output. I don't want to use string replace because input might be 10.4 with real dot.
Here as example code I am using,
Sheet firstSheet = excel.getSheetAt(0);
for (Row s : firstSheet) {
Iterator<Cell> cellIterator = s.iterator();
while (cellIterator.hasNext()) {
Cell currentCell = cellIterator.next();
if (currentCell.getCellType() == CellType.STRING) {
System.out.print(currentCell.getStringCellValue() + "--");
} else if (currentCell.getCellType() == CellType.NUMERIC) {
System.out.print(currentCell.getNumericCellValue() + "--");
String textValue = NumberToTextConverter.toText(currentCell.getNumericCellValue());
}
}
}
Notes:
Apache-poi version: 4.0
Java: 8.0
Thanks in advance