Hi Scott,
Currently HSSF doesn't support "custom" formats. It supports the
default formats in Excel only. If the format you're using happens to be
one of said formats you can do
HSSFCellStyle.setDataFormat(HSSFDataFormat.getFormat("#,##0.00")) for
instance.
To see relevant documentation on this see:
http://jakarta.apache.org/poi/hssf/how-to.html
as well as the javadoc for HSSFDataFormat. There is a code sample that
uses it in context.
hope that helps,
Andy
On Wed, 2002-07-10 at 14:43, Scott D Smith wrote:
> I have an HSSF question regarding HSSFCells that have a CellType of
> CELL_TYPE_NUMERIC.
>
> I am wanting to specify that a Cell has a numeric value (71.843 for
> example) then somehow, possibly through an HSSFCellStyle, indicate that the
> Cell is supposed to only *display * a certain number of decimal places,
> such as only one decimal place which yields 71.8 in my example above. I
> tried to find a way to do this by looking in the POI Javadoc but had no
> luck. Anybody else ever try this and find a solution?
>
> I realize that in Java code I could round the number before inserting its
> value into the Cell to begin with, but the user community I am serving
> would prefer to preserve the original number with more decimal places, just
> display the rounded version.
>
> Any ideas are appreciated!
>
> Scott Smith
> Application Architecture Development, Hallmark Cards Inc.
> Sun Certified Java 2 Programmer
> Sun Certified Web Component Developer
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
http://www.superlinksoftware.com - software solutions for business
http://jakarta.apache.org/poi - Excel/Word/OLE 2 Compound Document in
Java
http://krysalis.sourceforge.net/centipede - the best build/project
structure
a guy/gal could have! - Make Ant simple on complex Projects!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>