Here's a sample of the code I have:

HSSFCell cell = row.createCell(cellnum);
double thenumber = 358;
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
HSSFDataFormat df = workbook.createDataFormat();
cell.setCellStyle(df.getFormat("0.00"));

Now if I run this code, it will display "358" in all of my cells in excel
(and openoffice).  If I right click on these cells, and go to "Format
Cells", and look at the current formatting, it is set as I defined (with 2
decimal places).

If I click on one of these cells to edit it, don't change anything and click
in another cell, the cell will suddenly display with the 2 decimal places.

So my xls file seems to contain the correct formatting, but is displaying
without it until I edit a cell?  Anyone know what's going on?

Thanks,
Dave

Reply via email to