Yes, you need to create a different style object for each cell style that your sheet requires. Typically, people tend to accomplish this task at the start of the application - assuming of course they know at that stage all of the cell styles they require. This is not to say, of course, that there is anything wrong with creating styles as you go, just try to avoid duplicates if memory could be an issue for you.
If you do try to reuse cell styles by modifying the style object once it has been created, you will (should) find that all of your cells will have the same appearance. This occurs because the cell style objects are interpreted (interrogated) when you call the write method if I understand correctly. --- On Sun, 6/8/08, suriz4u <[EMAIL PROTECTED]> wrote: From: suriz4u <[EMAIL PROTECTED]> Subject: Needs clarity about Cell Styles To: [email protected] Date: Sunday, June 8, 2008, 10:49 PM Hi all Iam using cellstyles in POI to generate excel.For formatting different datatypes iam using different styles. For example for formatting date iam using HSSFCellStyle csDate = wb.createCellStyle(); Iam creating different cellstyles for different datatypes.I tried to use only one cellStyle but it doesnt worked. Is it recommendable to create different cell styles for different datatypes??? Please any one can give me solution for this... Thanks Suresh G -- View this message in context: http://www.nabble.com/Needs-clarity-about-Cell-Styles-tp17726681p17726681.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]
