poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Moots <alex....@utoronto.ca>
Subject DateFormat "m/d" does not work
Date Mon, 29 Dec 2003 15:28:19 GMT
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


Mime
View raw message