-
1. Re: Not able to change the color of cell text in Seam Excel
herberson Jul 12, 2010 4:09 PM (in response to lavanyak)Try create a transient method in Emplyee class that return the color.
-
2. Re: Not able to change the color of cell text in Seam Excel
lavanyak Jul 12, 2010 11:44 PM (in response to lavanyak)Hi Herberson,
Thank you for your reply.
I tried defining a color property and its corresponding getter/setter method in Employee class and tried setting the color, but it did not worked out as desired.
But If I hard code any color value it works correctly as below-
<e:cell value="#{employee.name}" style="xls-font-size: 8; xls-font-color='red'"/>
But I want to set text color conditionally.
Also, what do you actually mean by 'transient method'?
Thanks.
-
3. Re: Not able to change the color of cell text in Seam Excel
herberson Jul 13, 2010 7:14 AM (in response to lavanyak)Transient method is that one
marked
with @Transient annotation, by doing so you are saying to JPA that the values returned by a method or stored in a attribute isn't persisted in database.Knowing that, your Employee class will look like this:
/* your imports */ import import javax.persistence.Transient; @Name("employee") @Entity public class Employee implements Serializable { /* your implementation */ @Transient public String getColor() { if (this.resigned) { return "black"; } else { return "red"; } } @Transient public void setColor() { //nothing to do } /* your implementation */ }
And your <e:cell \> tag will look like this:
<e:cell value="#{employee.name}" style="xls-font-size: 8; xls-font-color='#{employee.color}'"/>
It may seem awkward but that is the way I found to address issues like yours in my code.
Herberson
-
4. Re: Not able to change the color of cell text in Seam Excel
lavanyak Jul 13, 2010 9:04 AM (in response to lavanyak)Herberson,
My employee class is not an entity bean, so I think that @Transient is not required for this case.
I tried the approach that you had suggested, but it is not working for me. Did this practically worked for you?
Thanks.
-
5. Re: Not able to change the color of cell text in Seam Excel
jeenaraju Sep 16, 2010 5:40 AM (in response to lavanyak)You can change the color of a cell in excel by giving
<e:cell value="Hello world" row="7" column="0"
style=" xls-background-color: gray_25;"/>
also you can use the following colors, Please try it.
unknown, black, white, default_background1, default_background,
palette_black, red, bright_green, blue, yellow, pink, turquoise,
dark_red, green, dark_blue, dark_yellow, violet, teal, grey_25_percent,
grey_50_percent, periwinkle, plum2, ivory, light_turquoise2, dark_purple,
coral, ocean_blue, ice_blue, dark_blue2, pink2, yellow2, turqoise2, violet2,
dark_red2, teal2, blue2, sky_blue, light_turquoise, light_green,
very_light_yellow, pale_blue, rose, lavender, tan, light_blue, aqua,
lime, gold, light_orange, orange, blue_grey, grey_40_percent, dark_teal,
sea_green, dark_green, olive_green, brown, plum, indigo, grey_80_percent,
automatic, gray_80, gray_50, gray_25] -
6. Re: Not able to change the color of cell text in Seam Excel
jeenaraju Sep 16, 2010 5:43 AM (in response to lavanyak)<e:cell value="Hello world" row="7" column="0"
style="xls-font: coral bold 9 Arial; xls-background-color: gray_25; xls-font-size: 16;xls-border: thin black"/>