poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Svede <jsv...@yahoo.com>
Subject Re: Getting Decimal Instead of Text String
Date Sat, 04 Jun 2011 03:08:05 GMT
Nick Burch posted this on the dev mailing list and I think it might apply here, 
too:

"You probably just want to apply the formatting rules to the cell when you 
extract it. org.apache.poi.ss.usermodel.DataFormatter should help here".

Though I may be wrong so take it with a grain of salt....

HTH,

Jon





________________________________
From: eugenebalt <eugenebalt@yahoo.com>
To: user@poi.apache.org
Sent: Fri, June 3, 2011 3:47:57 PM
Subject: Getting Decimal Instead of Text String

I am using Apache POI-HSSF for working with Excel files.

I have a cell in my spreadsheet that looks like "115". I verified that it is
formatted as "Text" (Format Cells -> Text).

However, when I read it in as
row.getCell(0).toString()

I get this string: "115.0"

This is incorrect. I should be getting "115" since it's explicitly formatted
as Text. How can I get the desired result? The cell can be anything, numbers
or characters, and I expect the same string as in the cell. Thanks


--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Getting-Decimal-Instead-of-Text-String-tp4452662p4452662.html

Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message