Dynamically change background color in Crystal Reports.Net

  • Thread starter Thread starter ngpost1
  • Start date Start date
N

ngpost1

I have a Crystal Reports.Net report being generated from my C#
application. I would like to change the background color of the
details section (not the text mind you) of the report on certain
conditions. For example if the value of the 'Meeting Number' is
greater than 100 the background color of the details section will be
light yellow, otherwise it will be white. There will be multiple
records in this reports so one (or a few) detail section might be
yellow while all others on the page are white; or vice versa. I could
either change the color of the background section to yellow or possibly
create a yellow rectangle around the section and turn it
visible/invisible at runtime depending on the value of my field.

Does anyone have any ideas on how I can accomplish this?

TIA,

ngpost1
 
I have a Crystal Reports.Net report being generated from my C#
application. I would like to change the background color of the
details section (not the text mind you) of the report on certain
conditions. For example if the value of the 'Meeting Number' is
greater than 100 the background color of the details section will be
light yellow, otherwise it will be white. There will be multiple
records in this reports so one (or a few) detail section might be
yellow while all others on the page are white; or vice versa. I could
either change the color of the background section to yellow or possibly
create a yellow rectangle around the section and turn it
visible/invisible at runtime depending on the value of my field.

Does anyone have any ideas on how I can accomplish this?

TIA,

ngpost1
I found a way to do this - kinda.

I added a new field to my report's DataSet called Highlight. I added
that field to my report and set the background color, border and text
color all to be light yellow. I set the SupressIfZero property to
True. At runtime, I loop through the DataSet and if Meeting Number is
greater than 100 I set the value of the Highlight field to X otherwise
I set it to and empty string.

When the report is rendered if the Highlight field is not empty (per
the SupressIfZero setting) it will be displayed; otherwise it is
suppressed. Because the border color, background color and text is all
the same color it just looks like a yellow box around everything.

ngpost1
 
Back
Top