Dear Shawn, 

Thanks a Lot.It helped but there is one problem I am facing-> for -ve
numbers,it displayes the data as (Data) and not -Data..How to rectify that?

Thanks again



Warm Regards,
Mili Aggarwal

----------------------------------------------------------------------------
-----------------------------DISCLAIMER-------------------------------------
----------------------------------------------------------------------------
---------

This message and any attachment(s) contained here are information that is
confidential, proprietary to HCL Technologies and its customers. Contents
may be privileged or otherwise protected by law. The information is solely
intended for the individual or the entity it is addressed to. If you are not
the intended recipient of this message, you are not authorized to read,
forward, print, retain, copy or disseminate this message or any part of it.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.




-----Original Message-----
From: Shawn Laubach [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 30, 2005 9:41 AM
To: 'POI Users List'
Subject: RE: DataFormat of Cells

You could also use one of the 4 built in formats for money:
5, "($#,##0_);($#,##0)"
6, "($#,##0_);[Red]($#,##0)"
7, "($#,##0.00);($#,##0.00)"
8, "($#,##0.00_);[Red]($#,##0.00)"

To get them, do something like
oCS.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")
); or if you want red use the one below it.

To see all built in formats go to
http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFData
Format.html and if you want a custom format you can look at the example in
the quick guide at
http://jakarta.apache.org/poi/hssf/quick-guide.html#DataFormats.

Shawn


-----Original Message-----
From: KHZ (SAW) [mailto:[EMAIL PROTECTED]
Sent: Friday, January 28, 2005 6:28 AM
To: 'POI Users List'
Subject: AW: DataFormat of Cells

Hi Mili.

It should be something similar to (adapt it to your needs)

oCS.setDataFormat(oFmt.getFormat("#,##0 \u0080"));

oCS is the HSSF cell style a and oFmt is the HSSF data format. Instead of
\u... (which was taken for Euro) you take your $ sign ($ should be a
standard ASCII character; I hope so).

If I remember it right 0 says that the output is mandatory. So you format up
to the maximum number of characters which can occur and add the things
behind the "." with 0. It's some time ago. So I hope I remember it right.

Regards,        Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: Mili Aggarwal, Noida [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 28. Januar 2005 12:34
An: POI Users List
Betreff: DataFormat of Cells

 

Hi All,
        An Excel sheet provides for formatting cells in "Accounting"
format.
Does POI provide any such feature?

Actually, my requirements wants me to display data in the form of $xyz.ab,

Where, no of digits before decimal can be of any length but after the
decimal ONLY 2 digits are allowed but the String should be prefixed by $.

Can anyone tell me how to accomplish the same ASAP.

Thanks a LOT in advance..


Warm Regards,
Mili Aggarwal

------------------------------------------------------------------------
----
-----------------------------DISCLAIMER---------------------------------
----
------------------------------------------------------------------------
----
---------

This message and any attachment(s) contained here are information that is
confidential, proprietary to HCL Technologies and its customers.
Contents
may be privileged or otherwise protected by law. The information is solely
intended for the individual or the entity it is addressed to. If you are not
the intended recipient of this message, you are not authorized to read,
forward, print, retain, copy or disseminate this message or any part of it.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to