poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, David" <david.ander...@thomsonmedia.com>
Subject Question about dateformats not working.
Date Thu, 10 Jul 2003 20:43:55 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message