poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ssp <ssp...@gmail.com>
Subject round off digits in apache poi ss workbook
Date Sat, 14 Sep 2013 01:34:44 GMT
Hi,

I am trying to round off the decimal number with precisaion value 2, but it
is not working, let me know the problem in my below code:

    CellStyle cs = wb.createCellStyle();
    DataFormat df = wb.createDataFormat();
    cs.setDataFormat(df.getFormat("0.0"));
   
   
    for (int i=14;i<rows;i++)
                                {
                    Cell  y=   wb.getSheetAt(0).getRow(i).getCell((short)
colValue);
                   
            if (y.getCellType() == Cell.CELL_TYPE_STRING) {
                           
                    } else if (y.getCellType() == Cell.CELL_TYPE_NUMERIC) {
                           
                            float d=(float) y.getNumericCellValue();
                            y.setCellStyle(cs);
                                   }
                                    }   



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/round-off-digits-in-apache-poi-ss-workbook-tp5713756.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message