You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by jakub kuzela <po...@gmail.com> on 2008/04/11 19:42:37 UTC

Re: excel data format - SOLVED

Hi again,

u were right, this is not built-in format. I was abroad because i have this
format in excel in other dates formats and i dont add there anyone. Thank
you for directions.

my solution:
    HSSFCellStyle cellStyle = wb.createCellStyle();
    HSSFDataFormat format = wb.createDataFormat();
    cellStyle.setDataFormat(format.getFormat("mm/dd/yy;@"));

and little bit theory from http://sc.openoffice.org/excelfileformat.pdf site
174:
    "All indexes from 0 to 163 are reserved for built-in formats. The first
user-defined format starts at 164."

Thank again, Jakub.



2008/4/11, Nick Burch <ni...@torchbox.com>:
>
> On Fri, 11 Apr 2008, jakub kuzela wrote:
> > i am trying set my cells to this date format "20.12.08". It's predefined
> > format in excel 2003
>
>
> Predefined in excel 2003 could well be actually a custom format. Your best
> bet is to just request the format dd/mm/yy, and use the id that that gives
> you
>
>
> > I try set this format by using HSSFDataFormat.getBuiltinFormat
>
>
> I'd advise against using HSSFDataFormat.getBuiltinFormat, unless you're
> sure it's really a builtin one. Just ask for the format normally, and
> it'll be added as needed
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>