0

I have an excel file that contains this cell value 7501035907584 I want to be able to read the cell value into a string variable without any alteration. What I tried to use was the DataFormatter class but the result of the formatting was "7.50104E+12" which is not what I want. Is there a way to tell Apache POI to read the numeric cell value as it is?

This is the code I used:

DataFormatter formatter = new DataFormatter()
String barcode = formatter.formatCellValue(cell)

Note: I don't want to change the cell type because it's haram according to the holy docs

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
user3768828
  • 13
  • 1
  • 7

1 Answers1

0

My solution was to convert: numericCellValue -> BigDecimal -> BigInteger -> String

BigDecimal.valueOf(cell.numericCellValue).toBigInteger().toString()
user3768828
  • 13
  • 1
  • 7