poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Cheshire <cchesh...@bigredwire.com>
Subject dataformat problems
Date Thu, 06 Feb 2003 20:18:25 GMT
Hi,

I am having problems using the built in data formats in v1.8. (Note - I 
have looked at the code for the latest 1.9 build and it appears that 
this problem may exist there too).

The cell formats for 0x5 - 0x8 and 0x26 to 0x2c do not work as expected. 
I am specifically trying to use 0x28. The javadocs say this format 
string is "(#,##0.00_);[Red](#,##0.00)".

If I set the data format using using

myStyle.setDataFormat(0x28)

and build the spreadsheet and open it in excel 2000 the cells are 
formatted as expected.

If I set the cell data format by

myStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")) 


and build and open the spreadsheet the cell is not formatted properly. 
The data is in the cell but it does not initially appear - I can click 
on the cell and the data appears at the top of the screen in the cell 
entry area. When I go to the cell format screen and click on custom 
formats there is a list that more or less matches the list in the 
javadocs for the HSSFDataFormat class EXCEPT the leading parenthesis is 
not included in the format string. eg. "#,##0.00_);[Red](#,##0.00)" for 
0x28 instead. This leads me to believe that the format strings in the 
HSSFDataFormat class are set incorrectly - while their constants match 
the index of the standard excel custom formats, the actual strings don't 
quite match for the ones specified above.

I hope I have explained this enough.

Regards

Chris



Mime
View raw message