Alternate row colors in Crystal Reports


'Code By Kiran Reddy
'Flexible way to give alternate Color to rows of a Crystal Reports

'Create a formula with following code called ColorDeclaration with VB Syntax and place it on report header.
WhilePrintingRecords;
numberVar colorNum:=0;
colorNum;

'Create a formula with following code called ColorFormula with VB Syntax and place it on row .
WhilePrintingRecords;
numberVar colorNum;
colorNum:=colorNum;
if colorNum = 0 then
colorNum := 1
else
colorNum := 0;
colorNum;

//Right click on the section and select Section expert and go to Color tab
//Click on formula button(X+2) and add following code (leave Crystal Syntax as it is)

if {@ColorFormula } = 1 then
white
else
rgb(229,229,229); //or you can also give a Color name


You can view this article online at:
http://www.kiranreddys.com/knowledgebase/index.php/article/alternate-row-colors-in-crystal-reports