Shane
Shane

Reputation: 13

Reporting Services : Changing a specific cells background color

Does anyone know how to change the background color of a single cell, to a color specified by the hex number in SSRS? There are multiple different hex numbers in the database, for multiple different records and each color corresponds to something.

Upvotes: 1

Views: 57

Answers (2)

Sébastien Sevrin
Sébastien Sevrin

Reputation: 5405

Assuming:

  • Your hex value is 6 digits prefixed by a #
  • The column containing the background color you want to apply is called BGColor

Here is what you can do:

  1. Select all the cells you want to format
  2. In the Properties window (press F4 if not shown), under Fill, locate the BackgroundColor property
  3. Change it to the following expression: =Fields!BGColor.Value

Note
If your hex value is not in the required format, you have 2 options:

  • Update the query accordingly
  • Change the expression, you could use Custom Code or just some string operation functions like Right or Left for example

Upvotes: 0

SQLHound
SQLHound

Reputation: 562

Within each cell is a Color property that you could set to the column value. The properties window can be found in the View tab at the top.

Upvotes: 1

Related Questions