Custom format is support in 1.9.

try the following:

HSSFDataFormat customFormat = wookbook.createDataFormat();
cellStyle.setDataFormat(customFormat.getFormat("00000"));
cell.setCellStyle(cellStyle);

You can set custom format for a cell through cell style.

Hope that helps.

Calvin


----- Original Message ----- 
From: "Andy Lee" <[EMAIL PROTECTED]>
To: "POI Users List" <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 2:10 PM
Subject: Re: Preserving Leading Zero


> At 1:44 PM -0800 2/3/03, Calvin Cheung wrote:
> >A format such as "00000" will guarantee a five digit number.
> >
> 
> How can you make a cell use that format?  I thought HSSF could only 
> use built-in data formats.  I'd love to know if there is a way to 
> apply a custom format programmatically -- I have some dates that I 
> want to format in a non-built-in way.
> 
> --Andy
> 
> ---------------------------------------------------------------------
> 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