This project is read-only.

The cell format "0.00" seems not work

May 19, 2011 at 8:56 AM
Edited May 19, 2011 at 8:59 AM


I was wondering if the format "0.00" doesn't work perfectly or I used it in the wrong way.

My code is

HSSFCellStyle cellStyle = (HSSFCellStyle)hssfworkbook.CreateCellStyle();
cellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00");

Row row = sheet1.CreateRow(i);
row.GetCell(j).CellStyle = cellStyle;

I am using Office 2007 and expect to have "1.10" but only get "1.1" in the Excel file.

Can anybody tell me why?Any answer weill be appreciated

May 26, 2011 at 4:14 AM

Try this code: