Many apologies, I'm mentally crossing the streams of multiple pieces of work.
In the below scientific notation case the number is stored in raw form exactly as I would want it to be outputted. Issue being the org.apache.poi.ss.usermodel.DataFormatter in the example code uses the discovered format index/string (in my particular case "0.00E+00") for output. I lose precision and may have trouble parsing that elsewhere. To answer my own question: I'm probably going to go the route of always outputting the raw number. I will not use the number formatter. Issue as a result of that decision: I'll have to handle, in the consuming application, parsing Excel dates in their serial format and I'm now interested to see how I'll end up handling time durations. -----Original Message----- From: Matt Rogghe [mailto:[email protected]] Sent: Wednesday, July 28, 2010 3:13 PM To: [email protected] Subject: POI Excel xssf scientific notation Howdy all, Minor issue I'm looking for practical hints on: Using: POI 3.7 beta1 Code is heavily based on the XLSX2CSV example program in the Apache examples svn. Modified to output to a file and in flat file format (not CSV). This is the event driven side, not the user side. Ie... I don't have any POI Excel Cell objects to work against...just the text and attributes read using the SAX parser. Everything works beautifully except for some number handling. Excel prefers to store some numbers in scientific notation. I need to output that to the flat file as an actual number (1E-2 converted to .01 or 0.01). In all of these generic number cases there are no format strings from Excel. The default handling in the above example code is to output the text as found. Option A: Simply test for the 'E' and convert as necessary. Some goofiness around precision I have to be careful of but doable. My question/concern: This feels clunky and I'm somewhat expecting it to miss other Excel peculiarities I haven't encountered yet. Has anyone else tried to handle this and run into any unforeseen problems? --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
