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.

image

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.

7 comment(s)
Nate Laff

Looks great. XtraReporting for 8.3 is looking good!

28 October, 2008
Tarik Souirji

Thank you DevExpress !

28 October, 2008
Robert Thomas

It would be nice if our formatting rules in XAF were applied in the XAFReport module.  Has that been considered yet?  Thanks.

28 October, 2008
Linton

Nice feature, thanks!

28 October, 2008
Mike_Grace

Is there a formatting rule which wouuld allow visible true or false.

I have reports where, based on rules, reports bands are either shown or hidden. I would be much easier to put this in the design view rather than the code behind.

29 October, 2008
Alan (DevExpress)

Mike,

Yes, in v2008 vol 3 it will be possible not only to customize the appearance of a control or a band, but also to set the Visible property to True or False based upon a certain condition. I hope you'll like this feature! ;-)

29 October, 2008
Shum Hussain

Alan!

thanks!! This is what i was looking for!!!!

4 December, 2008

Please login or register to post comments.