That's because it is not a built in format.  You need to get an actual
HSSFDataFormat object and ask it for the format.  An example is at:
http://jakarta.apache.org/poi/hssf/quick-guide.html#DataFormats

Shawn

-----Original Message-----
From: Alex Moots [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 29, 2003 9:28 AM
To: POI Users List
Subject: 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to