yogesh lawate
yogesh lawate

Reputation: 227

Crystal Report column font set Dynamically based on a condition

Crystal Report

I am using Crystal Report for generating Reports.

I have to set the font size and color of "Test Result" column based on "Noramal Range" column.

if "Test Result" (12) is in range of "Normal Range"(12-13) then

size =15 and color =red

else

size =10 and color =Green

Both Columns are in Details section of Crystal Report and i have assigned value to it using set data source property of Crystal ( rpt.SetDataSource(ds1.Tables[0]))

I have used

 FieldObject field;

 field = rpt.ReportDefinition.ReportObjects["TestResult1"] as FieldObject;

 Font fo = new Font("Arial Black", 15F, FontStyle.Bold);

 field.ApplyFont(fo);

 field.Color = Color.Red;

But this gets applied to the whole column and not to a particular Row.

Please Help.

Upvotes: 1

Views: 1661

Answers (1)

Siva
Siva

Reputation: 9091

If you apply a condition in Detail section then the property will be applicable to all the records displayed in detail section, It is the functionality of crystal reports.

In your case if you want to do any formating to particular row then you need to include the Testname column in the condition so that the formating will be limited.

Upvotes: 2

Related Questions