locked
Font Color change depending on Background color. RRS feed

  • Question

  • Font Color change depending on Background color.

    I m using Three different colors in Background textbox, i.e. Green , Yellow, Red.

    I want to set the Font Color as If

    If  textbox is Green Font color should be white,

    If textbox is Red font color should be White,

    If textbox is Yellow Font color should be Black.

     

    Please let me know how to write the expression for the same, I m using VS2005.

     

    Friday, February 4, 2011 5:18 AM

Answers

  • Hi,

    You can assign the colors for background and font by assigning the expression to concern fields.

    if you wnat to assign background color to the textbox then goto text box properties in report and goto fill tab and write a expression for that. Also if you same the pass the one of color as paramenter then you can set another as per expression.

    for font color please follow the same steps as above and instead of fill goto font in properties.

    Please let me know its working  for you or not.

    Please mark it as answer if it helps you in getting solution.


    Thanks, Pranil Yambal | MCTS | Pranil.Yambal@hotmail.com
    • Marked as answer by Tony Chain Monday, February 14, 2011 1:13 AM
    Friday, February 4, 2011 7:11 AM
  • Hello,

    Are you suing anu expression for getting the background color for the textbox. If so then you can use the same expression for the font color too.

    Post the background color expression.

    Hope it clear & helpful....


    Pavan Kokkula Tata Consultancy Services.
    • Marked as answer by Tony Chain Monday, February 14, 2011 1:13 AM
    Friday, February 4, 2011 7:15 AM
  • Hi Pradeep,

    Based on my testing, we are not allowed to refer to the BackgroudColor property of another textbox. So, as Pavan suggested, please specify the same expression to the Color property, and then replace the color name in the expression based on the criterion.

    Thanks,
    Tony Chain


    Tony Chain [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by APradeep Tuesday, February 15, 2011 3:05 PM
    Wednesday, February 9, 2011 7:23 AM

All replies

  • Hi,

    You can assign the colors for background and font by assigning the expression to concern fields.

    if you wnat to assign background color to the textbox then goto text box properties in report and goto fill tab and write a expression for that. Also if you same the pass the one of color as paramenter then you can set another as per expression.

    for font color please follow the same steps as above and instead of fill goto font in properties.

    Please let me know its working  for you or not.

    Please mark it as answer if it helps you in getting solution.


    Thanks, Pranil Yambal | MCTS | Pranil.Yambal@hotmail.com
    • Marked as answer by Tony Chain Monday, February 14, 2011 1:13 AM
    Friday, February 4, 2011 7:11 AM
  • Hello,

    Are you suing anu expression for getting the background color for the textbox. If so then you can use the same expression for the font color too.

    Post the background color expression.

    Hope it clear & helpful....


    Pavan Kokkula Tata Consultancy Services.
    • Marked as answer by Tony Chain Monday, February 14, 2011 1:13 AM
    Friday, February 4, 2011 7:15 AM
  • Hi,

     I have used this expression for font color,

    =IIf(Fields!Name.Value="S","Red","Black")

    Let me know if any queries.


    Thanks, Pranil Yambal | MCTS | Pranil.Yambal@hotmail.com
    Friday, February 4, 2011 7:23 AM
  • Thanks For your reply Pavan,

    Yes I m using expression for Background color, 

    I have to divide the report into two half's Before Nov-2010 and after 2010

    "iif(Fields!Report_Month.Value< "1-Nov-2010",iif(ReportItems!txtR.Value >= .67,"green",

     

     iif(ReportItems!txtR.Value < .67 AND ReportItems!txtR.Value > .62,"yellow","red")),iif(ReportItems!txtR.Value >= .70,"green",

     iif(ReportItems!txtR.Value < .70 AND ReportItems!txtR.Value > .65,"yellow","red")))"

     

     

    The above is the expression used , Yes i have used the same expression in Color also, But was trying the other way round,

    Instead of pasting the same expression wanted know if we can change the FONT Color depending on Background color textbox...

    Do we such  option in SSRS, If Yes please let me know.

     

    Regards

    Pradeep

    Friday, February 4, 2011 7:37 AM
  • Thanks For your reply Pranil,

    Yes I m using expression for Background color, 

    I have to divide the report into two half's Before Nov-2010 and after 2010

    "iif(Fields!Report_Month.Value< "1-Nov-2010",iif(ReportItems!txtR.Value >= .67,"green",

     

     iif(ReportItems!txtR.Value < .67 AND ReportItems!txtR.Value > .62,"yellow","red")),iif(ReportItems!txtR.Value >= .70,"green",

     iif(ReportItems!txtR.Value < .70 AND ReportItems!txtR.Value > .65,"yellow","red")))"

     

     

    The above is the expression used , Yes i have used the same expression in Color also, But was trying the other way round,

    Instead of pasting the same expression wanted know if we can change the FONT Color depending on Background color textbox...

    Do we such  option in SSRS, If Yes please let me know.

     

    Regards

    Pradeep

    Friday, February 4, 2011 7:38 AM
  • Hi Pradeep,

    Based on my testing, we are not allowed to refer to the BackgroudColor property of another textbox. So, as Pavan suggested, please specify the same expression to the Color property, and then replace the color name in the expression based on the criterion.

    Thanks,
    Tony Chain


    Tony Chain [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by APradeep Tuesday, February 15, 2011 3:05 PM
    Wednesday, February 9, 2011 7:23 AM