Xssfcell. Cell_Type_Numeric Changes Value 0 to 25
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?

1 Answer

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest