Joined: 18 Jan 2008
Online Status: Offline
Posts: 6
Topic: Different look of even/odd rows in detail section Posted: 18 Jan 2008 at 2:56am
Hello, please does anyone know how to make different look of even/odd rows in detail section? I want to swap 2 background colours - or display/hide a colour rectangle to have "color/white" look. Thanks for hints *D.
Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Posted: 18 Jan 2008 at 5:24am
Go to the Section Expert. Go to the section you want to color (presumably Details). Go to the Color tab on the right-hand side. Check Background Color on. Click on the "x-2" button next to the color selector.
The formula should look like:
If RecordNumber mod 2 = 0 Then crSilver Else crWhite
(Obviously, replace the colors with whatever you like.)
The modulo operator returns the remainder when the first number is divided by the second number. So, "RecordNumber mod 2" returns 0 on even records, and 1 on odd records.
This can be expanded to similar effects. So, to get a "greenbar" effect, in which the color changes for groups of five records, use:
If RecordNumber mod 10 >= 5 Then crGreen Else crWhite
Joined: 18 Jan 2008
Online Status: Offline
Posts: 6
Posted: 05 Feb 2008 at 11:46pm
This works perfect! Now I'm trying to find out how to change rectangle fill-colour depending on row number. I cannot find that magic button "x-2" in rectangle properties. Am I blind? Or is there any chance to do it? Thanks
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Posted: 06 Feb 2008 at 12:13am
True, the rectange doesn't have a formula button for the color (or any of the other properties). One trick would be to use an empty textbox as the rectange. Set the background color using a formula, and to make sure that it prints under the other report objects, set it to Move > To Back.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum