You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Alex Moots <al...@utoronto.ca> on 2003/12/29 16:28:19 UTC

DateFormat "m/d" does not work

Hi,

I'm trying to use POI to format some date values in a spreadsheet.  I 
need to get the date format in just month/day format (without the 
year).  I've been trying to do that with the following code:

   HSSFCellStyle normalStyle = project.WorkBook.createCellStyle();
   HSSFFont normal = project.WorkBook.createFont();
   normalStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d")); 
 //    
normalStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));    
 normalStyle.setFont(normal);

Whenever I use the given code I don't get the expected results in the 
created spreadsheet.  The spreadsheet just shows a number, which varies 
depending on the specified date, but is always incorrect and NOT 
formatted as a date.  If I use the commented line of code then things 
work properly, but it messes up the on-screen formatting of my 
spreadsheet as the column widths don't fit the year specification.
I'd appreciate it if someone could help out with this issue.  I can 
provide some screenshots or other details if necessary.

Thanks for your help.
Alex.



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