That's add as the data format 15 DEC is really "d-mmm-yy". Would it be possible to attach an example sheet along with a list of a cell or two that has that particular format.
Shawn -----Original Message----- From: Christian Gosch [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 15, 2005 10:36 AM To: POI Users List Subject: POI 2.5.1 final: Date value formatting to 'DD.MM.YYYY' Hi, I cannot successfully format a cell with "DD.MM.YYYY" nor with any other date format. All I get is "#.##0" number format for the cells. How can I achieve "DD.MM.YYYY" formatting? POI version: 2.5.1 final (this is fairly old, but there does not seem to be any newer "final" version :-( ) Code sample: // font for rows: HSSFCellStyle borderdFormat = workbook.createCellStyle(); // borderdFormat.setBorderTop( HSSFCellStyle.BORDER_HAIR); // should be... // borderdFormat.setBorderBottom( HSSFCellStyle.BORDER_HAIR); // should be... borderdFormat.setBorderTop( HSSFCellStyle.BORDER_DOTTED); // ...but is not (!) borderdFormat.setBorderBottom( HSSFCellStyle.BORDER_DOTTED); // ...but is not (!) [...] else if (data instanceof Date) { // data is of type Date log.debug("XLS-DL: Date: xlsZeile = " + xlsZeile + " spalte = " + spalte + " value = " + data + " class = " + data.getClass()); borderdFormat.setDataFormat((short)15); label.setCellValue( ((Date)data)); label.setCellStyle(borderdFormat); sdata = data.toString(); } The log.debug(...) output is like: XLS-DL: Date: xlsZeile = 1 spalte = 10 value = 1944-04-10 01:00:00.0 class = class java.sql.Timestamp The resulting cell value display in Excel2000 (deDE in W2KSP4 deDE) is: 16.172 which would be the result of formatting "10.4.1944" or "Apr. 10, 1944" with "#.##0". What am I doing wrong? regards, -- Dipl.-Inform. Christian Gosch Systems Development inovex GmbH Karlsruher Strasse 71 D-75179 Pforzheim Tel.: +49 (0)72 31 - 31 91 - 85 Fax: +49 (0)72 31 - 31 91 - 91 mailto:[EMAIL PROTECTED] http://www.inovex.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
