Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Colors in Report 1

Status
Not open for further replies.

yagnik3128

Programmer
Jun 14, 2001
64
IN
Hello,

Is it possible to change colors of a particular section of a report through VB programming? As fonts of a particular section is possible by giving the property of report like sectionfonts.

If anybody knows, Please help me.
 
There is no need to resort to VB to do this it is supported from within Crystal. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Thanx dgillz,

But if user wants to change the color of a particular section for a report. so, i have to give the option to select the color from the color pallete & then i have to pass that color to crystal report. As user wants to select different colors on different time.

Please help me.
 
In order to do this, you will have to set up a parameter in your report so that your user can choose the colour. I will assume that the choices are R(ed), G(reen), & B(lue).

On the Font tab of Format Field, click on the X+2 button on the Color line. You will use a formula like this one:

[tt]
if {?ColourParam} = "R" then Red
else if {?ColourParam} = "G" then Green
else if {?ColourParam} = "B" then Blue
[/tt]

If you click on the colour choices in the Color Constants section of the Function Tree, recent versions of Crystal will put [tt]crRed[/tt] instead of [tt]Red[/tt] in the formula. Don't worry, both will work in recent versions...

Nota: If you want your user to choose a background colour, the last line of the formula should be:

[tt]
else NoColor
[/tt]

or

[tt]
else White
[/tt]

Try doing a background colour without this and you'll see what I mean!

HTH,

John Marrett
Crystal Reports & Crystal Enterprise Trainer
 
yagnik,

You are talking about using a color pallete, so I assume you are capturing the RGB values. If you can capture the 3 values as numerics, you can pass them to three numeric parameter fields in CR, and then use these fields in the formatting condition with a formula like:

Color ({?Value1},{?Value2},{{?Value3}) Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top