poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "H@rry" <apache...@SoftHome.net>
Subject RE: How to get "12345" to be a real string?
Date Wed, 05 Feb 2003 03:29:23 GMT
In the API, class HSSFDataFormat

0x31, "@" --> is for text format. and 0x31 = 49


Open your excel and go to that cell you have set the text value.
Then Goto Menu-->Format-->Cell, there under the Number Tab,	the
cell is set to "Text" and there is an explaination on Excel will
treat values in the cell.


Not sure why
	HSSFDataFormat.getBuiltinFormat("@") return -1 instead of 49.

Could be a bug...but believe it is fixed in 1.9.0.


"I know that the world is always unfair.
 But I don't understand why it is never  unfair to my advantage."


@harry


-----Original Message-----
From: Andy Lee [mailto:aglee@earthlink.net]
Sent: Wednesday, February 05, 2003 1:33 AM
To: POI Users List
Subject: RE: How to get "12345" to be a real string?


At 1:37 PM +0800 2/4/03, H@rry wrote:
>I set directly using this
>
>	HSSFCellStyle cs = cell.getCellStyle();
>       cs.setDataFormat((short)49);
>       cell.setCellValue("12345");
>
>All values entered in the cell will be treat as text...no matter wat you
key
>in.

Thanks, that works.

Can you explain what is going on, and how you arrived at the magic number
49?

How does this data format preserve the "stringness" of the field
without showing a leading apostrophe?  I would have expected the
field to show up as

     '12345

when I double-click it, but it shows up as

     12345

--Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Mime
View raw message