Hi Nick ,

please find the code i have written to convert the data in cells to one
decimal place.

for (int i=14;i<rows;i++)
                            {
                HSSFCell  y=   wb.getSheetAt(0).getRow(i).getCell((short) 
colValue);
                
        if (y.getCellType() == HSSFCell.CELL_TYPE_STRING) {
                        
                } else if (y.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
                        
                        float d=(float) y.getNumericCellValue();
                        
                                HSSFCellStyle cs = wb.createCellStyle();
                             HSSFDataFormat df = wb.createDataFormat();
                             cs.setDataFormat(df.getFormat("0.0"));
                             cs.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
                             y.setCellStyle(cs);
                                     
                                
                                }
                                }
Finally i am not getting the numbers rounded to one decimal place.
Please help me on this.

Thanks
Rakesh

--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Round-to-one-Decimal-place-not-happenning-using-style-setDataFormat-format-getFormat-0-0-tp3404980p3406162.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to