I think that you are getting confused between the cells contents and the value the user sees displayed when viewing the sheet using Excel. Remember that the latter will be formatted by Excel using the rules that are contained within the cells formatting information. When you use HSSF/XSSF you will get the value the cell actually contains - or as near as possible with some numerical values - and you need to format it yourself to get the same result the user sees when viewing the sheet using Excel.
Have a look at the HSSFDataFormatter class. It contains a method called formatCellValue() that is most likely the one you want to use. Koushik Mitra wrote: > > HI, > > I was trying to extract content from an xlsx file. > However, I am getting julian date value for a cell with date format and > '1.0' in place of '100%'. > I want to retain the value as present in that xlsx file. > > Solution appreciated. > > Thanks, > Koushik > > **************** CAUTION - Disclaimer ***************** > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended > solely > for the use of the addressee(s). If you are not the intended recipient, > please > notify the sender by e-mail and delete the original message. Further, you > are not > to copy, disclose, or distribute this e-mail or its contents to any other > person and > any such actions are unlawful. This e-mail may contain viruses. Infosys > has taken > every reasonable precaution to minimize this risk, but is not liable for > any damage > you may sustain as a result of any virus in this e-mail. You should carry > out your > own virus checks before opening the e-mail or attachment. Infosys reserves > the > right to monitor and review the content of all messages sent to or from > this e-mail > address. Messages sent to or from this e-mail address may be stored on the > Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://www.nabble.com/Getting-incorrect-value-while-trying-to-extract-content-from-xlsx-tp23273439p23291063.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
