Conditional highlighting

Hi, I'm newbie to fastreport.
1. Is there a way to Conditional highlighting through code?
2. in the Conditional highlighting window - how do I write a conditional saying that the value[i+1] > value ?

Thanks

Comments

  • Hello!

    Every TextObject has a Highlight property a collection of HighlightCondition objects. You can add conditions in your code before calling report.Prepare():

    using System.Drawing;
    using FastReport;
    
    var textObj = report.FindObject(“Text1”) as TextObject;
    if (textObj != null)
    {
    var condition = new HighlightCondition
    {
    Expression = “Value < 0”,
    Fill = new SolidFill(Color.LightCoral),
    ApplyFill = true,
    TextColor = Color.DarkRed,
    ApplyTextColor = true
    };
    textObj.Highlight.Add(condition);
    }
    

    Be sure to set the appropriate flags: ApplyFill = true, ApplyTextColor = true, and ApplyFont = true, so that the style is applied when the condition is met.

This discussion has been closed.