SSRS Dynamically change the cell background and font color
Asked Answered
H

2

7

I need to change the Table Cell Background color to Yellow and Font color to Bold / Red for values which are less than 80.

Cell Expression is =Fields!Mark.Value

How to change the Cell Background Color / Fill the Color to Yellow ?

Houdon answered 1/5, 2014 at 1:40 Comment(0)
F
11

Nearly everything in SSRS is an expression, so you can use VBA code to conditionally set the property value.

To set the background colour, set the BackgroundColor property of the table cell to be:

=IIF(Fields!Mark.Value < 80, "Yellow", "White")

To set the font to bold, set the Font-FontWeight property of the table cell to be:

=IIF(Fields!Mark.Value < 80, "Bold", "Normal")

To make the text red, set the Color property of the table cell to be:

=IIF(Fields!Mark.Value < 80, "Red", "Black")
Frogfish answered 1/5, 2014 at 2:23 Comment(3)
Same idea for making the text red - added expression to answerFrogfish
I would use Me.Value instead of Fields!Mark.Value for code that is easier to copy from cell to cell or report to report.Puling
just amazing tip :)Cooke
R
0
  1. select textbox ->right click-> go to property
  2. font->color->give your expression ex : =iif(Fields!status.Value="1","Green","Red")
Retroact answered 15/11, 2017 at 12:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.