Anthony Andrews wrote: > > Hello Rob > > If I remember correctly, getFormat() will take care of part of the problem > for you - it will check to see if a format exists with those features and, > if not, add it to the collection for the workbook. > > As for the first part of your question, I cannot offer an answer. I would > assume however that there is no way to separate the two pieces of > information - that is to specify that the number have a decimal portion in > the format and the number of places separately. Of course, you could do > something similar in your own application by creating a format class that > would contain all of the formatting information to be parsed just before > you called the write() method. May even look at it myself someday. > >
Yes, you're right that getFormat() will use an existing format if there's a match. I was just worried about the efficiency of creating those format strings dynamically for each numeric cell. But it seems to work well enough. I was about to do something like your suggestion of storing format parameters in a format class that I could scan instead of producing a format string for getFormat to look up. Theoretically that would be more efficient, but I don't know that it would be a noticeable boost to performance. I did something similar for cell styles, though. HSSFCellStyle doesn't have something like getFormat that will find or create a style as needed, so I had to do it. But the approach ended up working very well. Rob -- View this message in context: http://www.nabble.com/number-of-decimal-places-in-data-formats-tp20671940p20682608.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]
