0
integrityrecords.get(i).get(2)="0";
fieldsheet.getRow(1).getCell(3)
                    .setCellValue(integrityrecords.get(i).get(2));
System.out.println("coulmn 1  :" + integrityrecords.get(i).get(2));

I am trying get data from Database as an ArrayList of Strings and then writing it to excel using poi-3.14 XSSF. When i do so, I get the warning in excel cells where i am entering a number value in cell asking "Convert to Number". To overcome this, i use the additional code of setCellType().

fieldsheet.getRow(integrityStartRow).getCell(3).setCellType(XSSFCell.CELL_TYPE_NUMERIC);

When i do this, the cell value is changed to 25. This is happening for other decimal values that i enter into cell.

How to overcome this change?

Vinmee
  • 23
  • 2
  • 8

1 Answers1

2

setCellValue() should be called with the intended datatype. It seems you call it with a string-type, it should work better if you convert the string to a number before passing it in, then setCellType() should also not be necessary any more.

See also http://poi.apache.org/spreadsheet/quick-guide.html#CellTypes

centic
  • 15,565
  • 9
  • 68
  • 125