I'm writing code to dynamically assign an appropriate data type and format to
data presented as strings.  That is, I check the string for dollar,
percentage, numeric or date data before defaulting to string data.

All works fine (though it's a pain to have to do all that - it'd be nice to
have a method somewhere in POI to analyze a string and produce a data type,
format and optional numeric value in some highly optimized way).

Anyway, my problem comes with decimals.  I'm able to use getFormat to
produce custom formats with a variable number of decimal places based on how
many were in the input string, and that works fine.  Excel seems to display
these on the 'format cell' dialog under Custom.  But it also displays an
explicit 'Decimal places' edit box where you can control this.

My question.  Does excel support data formats like "0.%" with the number of
decimal places specified explicitly somewhere other than in the format
string?  It would seem much more efficient to work that way rather than to
have to parse format strings to determine the number of decimal places.

I guess this is another stupid question in the sense of 'why do you think we
call it the Horrible Spreadsheet Format'?  But can't hurt to ask.

In the meantime, I'm also wondering whether Java-wise, it'd be more
efficient to keep my own list of data type, #decimals combinations I've
encountered so far scan that for formats.  Or is it okay to just dynamically
build a string with the right number of decimals each time and let getFormat
take care of searching its list.  In other words, are all those string
concatenations expensive processing wise?  Or does it all pale next to the
parsing of the original strings to determine #decimals to begin with...

Thanks,
Rob
-- 
View this message in context: 
http://www.nabble.com/number-of-decimal-places-in-data-formats-tp20671940p20671940.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]

Reply via email to