poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suriz4u <suri...@gmail.com>
Subject Re: Needs clarity about Cell Styles
Date Mon, 09 Jun 2008 09:40:40 GMT


Thanks for such a good explanation.But in my application there is
requirement that alternative rows should be colored.As iam using different
styles for different objects.I tried to use in following way for different
objects

 HSSFCellStyle csDouble= wb.createCellStyle();
  if(!(rowNumber%2==0)) 
       csDouble.setFillBackgroundColor(HSSFColor.AQUA.index);

But it didnt worked in this way..
Is there any  solution for this???





Anthony Andrews wrote:
> 
> 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 &lt;suriz4u@gmail.com&gt; wrote:
> From: suriz4u &lt;suriz4u@gmail.com&gt;
> Subject: Needs clarity about Cell Styles
> To: user@poi.apache.org
> 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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
>       
> 

-- 
View this message in context: http://www.nabble.com/Needs-clarity-about-Cell-Styles-tp17726681p17729434.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message