DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change report font color with script based on criteria

Solved!
Go to solution

Is there a way to have the font color change for the report based on the determination found in the script?

For example this script checks to see if a value was exceeded and reports yes or no on an alert page of the report.

 

If Data.Root.ChannelGroups(1).Channels("Speed (rpm)").Maximum > 6300.1 Then
T1 = "YES"
Else
T1 = "No"
End If

 

I would like the YES text to be green and the No text to be red. Is this possible?

Thanks!!!

 

0 Kudos
Message 1 of 2
(2,380 Views)
Solution
Accepted by KarenD

Hi Karen,

 

You can place the text box you need, select it and right-click on it to rename it. In my example I name it MyText. Then you can use something like this to programatically change the color.

 

Call Report.ActiveSheet.Objects("MyText").Font.Color.SetPredefinedColor(ePredefinedColorRed)
Call Report.Refresh

You have another example here with a comment box : http://zone.ni.com/reference/en-XX/help/370858M-01/reportapi/properties/report_property_color_irepfo...

CLAMaxime -- Kudos are a great way to say thank you
Message 2 of 2
(2,343 Views)