DXperience v2008 vol 3: Conditional formatting in reports (WinForms and ASP.NET)

28 October 2008

An oft-requested feature in XtraReports is the ability to print certain report controls in the report differently based on some formatting rule. The rule would (presumably) be based on the values in the record bound to that control.

As usual, a picture is worth a thousand words. In this report the rows that have an extended price greater than $1000 are shown with a light green background.


In essence, the way this works is that the report controls you drop on the report designer surface have a property called FormattingRules, a collection of formatting rule objects. A formatting rule has a condition -- that is, an expression using the fields that evaluates to true or false -- and a set of display formatting properties, such as font color, attributes, background color and so on. At report generation time, these rules are evaluated and if satisfied the data is printed using the display formatting options. Otherwise, the default printing options are used.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.