Click here to Skip to main content
12,887,631 members (31,757 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 24 Feb 2008

Rows Coloring in Crystal Reports

, 24 Feb 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
The article intends to show how to color rows in Crystal Reports depending on the business requirement which might arise


During development there are chances that a person might encounter a problem of how to display colored rows in a crystal report, where colors themselves might actually represent something. I encountered this problem and was searching for solutions on the web but couldn’t find any. But in the end I cracked it, so I thought why not share it, so here goes. <o:p />



Shown above is an extraction from the report I was creating. To achieve such functionality you’d have to open the Section Expert from the Details Section. Then select the Color tab and then click on the formula button.


This would open the Formula Editor where you can specify the different conditions on to which the appropriate colors can be displayed. For more details on the available colors expand the Functions tree item in the Functions Tree, and look for the Color Constants tree item. Expanding it would reveal the list of supported colors.


<o:p />


The formula that I have used here is as follows:<o:p>

if({AgingList.Total}>({AgingList.Principal}+{AgingList.Profit})) then Crgreen
else if({AgingList.Total}=0) then Crblue
else if({AgingList.Total}<({AgingList.Principal}+{AgingList.Profit})) then CrYellow
else NoColor

(Note: Don’t forget to assign the NoColor color to the rows which do not fit to the requirements for the coloured lines else they may defaultly be displayed as blacked out.)

Save the report and Play. If all conditions satisfied you should be able to see the desired result.<o:p />

<o:p />


This procedure should solve the problem of colored rows where ever intended in the report.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sameer Siddiqui
Team Leader CodeAesthetics
Pakistan Pakistan
A small time software engineer with big time ideas. Helping others get their ideas on the road so that some day I can fuel mine.

Wannabe Software Designer, work in progress, obsessed with Aesthetics especially of Engineering.

Having spent over 8 years writing software professionally I have, atleast tried to help, many companies build and improve on their existing business implementations. Having gone solo for a few years now, I am constantly on the look out for people with problems looking for someone to help solve them whilst building a strong lasting professional relationship in the process.

You may also be interested in...

Comments and Discussions

Generalthanks Pin
anis_sg7-Apr-14 12:35
memberanis_sg7-Apr-14 12:35 
GeneralMy vote of 1 Pin
Daniel Nutu1-Feb-09 10:48
memberDaniel Nutu1-Feb-09 10:48 
Generalchange the font style at run time Pin
da_dhanaraj3-Nov-08 9:28
memberda_dhanaraj3-Nov-08 9:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170424.1 | Last Updated 25 Feb 2008
Article Copyright 2008 by Sameer Siddiqui
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid