I found the problem. Duh! I was naively assuming that if I put the String "1.5" into a spreadsheet cell, but then formatted it as a dollar amount, it would be treated as a numeric dollar amount by Excel.
Wrong!!! I have to put numeric values into the numeric cells, and date values into the date cells, and String values into the string cells. Then, all the formatting (at least all that I need to do) works just fine. Thanks, Jennifer Amon -----Original Message----- From: Amon, Jennifer [mailto:[EMAIL PROTECTED]] Sent: Monday, November 11, 2002 1:09 PM To: 'POI Users List' Subject: Re: HSSFDataFormat and accounting formats? I tried with jakarta-poi-1.9.0-dev-20021107, and get the same results. The cells report themselves as accounting, 2 decimal places, with dollar sign, but they look like this: 1.5 instead of $ 1,50 15 instead of $15.00 etc. Here's the code I'm using to set the accounting format. What am I doing wrong? HSSFCellStyle csdlr = wb.createCellStyle(); csdlr.setDataFormat(df.getFormat("_($* #,##0.00_);_($* (#,##0.00);_($* \"-\"??_);_(@_)")); Jennifer Amon -----Original Message----- From: Amon, Jennifer [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 07, 2002 3:17 PM To: 'POI Users List' Subject: RE: Shawn::: Re: HSSFDataFormat and accounting formats? I'm using jakarta-poi-1.9.0-dev-20021105. Did someone fix it this morning? Oh, you are not responding to my accounting format question. Sorry. We've actually go two threads going in one here. I never got a response to my message that when I use the accounting/$/2 format as it shows up in the custom format window, and as provided here, the column reports itself as being in the accounting format with 2 decimal places and a dollar sign; but visually, there is no dollar sign, the trailing zeros are dropped, and there is no vertical alignment of decimal points (or missing dollar signs). Thanks, Jennifer -----Original Message----- From: Seran, Sathiyan [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 07, 2002 3:08 PM To: 'POI Users List' Subject: RE: Shawn::: Re: HSSFDataFormat and accounting formats? Thanks Shawn, It works in newer version (I downloaded jakarta-poi-1.9.0-dev-20021107.jar). -Sathiyan >>>-----Original Message----- >>>From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]] >>>Sent: Wednesday, November 06, 2002 2:31 PM >>>To: POI Users List >>>Subject: Re: HSSFDataFormat and accounting formats? >>> >>> >>>select accounting, click ok. Go back to the cell and click custom.... >>>you get: >>>"_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)" >>> >>>Now why couldn't you guess that string off the top of your head? haha ;-) >>> >>>-Andy >>>Amon, Jennifer wrote: >>> >>>>Thanks, but I don't know how to find that. From within Excel, it just >>shows >>>>a $ and separately lets me specify a number of decimal places. I have no >>>>idea what that format would look like. >>>> >>>>Jennifer >>>> >>>>-----Original Message----- >>>>From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]] >>>>Sent: Wednesday, November 06, 2002 5:08 PM >>>>To: POI Users List >>>>Subject: Re: HSSFDataFormat and accounting formats? >>>> >>>>Yes, basically find the format string you would use in excel, and use >>>>that for HSSF. >>>> >>>>-Andy >>>> >>>>Amon, Jennifer wrote: >>>> >>>>>I can find the currency formats, but not the accounting formats >>>>>in the javadoc for HSSFDataFormat. The doc also says that >>>>>user defined formats may be used. One way or >>>>>another, can I get the dollar signs and decimal points to line >>>>>up in the column? >>>>> >>>>>Thank you, >>>>>Jennifer Amon >>>>> >>>>>----------------------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ________________________________________________________________________ This email has been scanned for all known viruses. _______________________________________________________________________ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ________________________________________________________________________ This email has been scanned for all known viruses. _______________________________________________________________________ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
