Print Page | Close Window

Change Backgorund Color

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5326
Printed Date: 02 May 2025 at 12:35am


Topic: Change Backgorund Color
Posted By: rcflyer2005
Subject: Change Backgorund Color
Date Posted: 26 Jan 2009 at 11:41am
This if my first Crystal Report! I using CR XI.

I am creating a report from a MySQL table.  There are 1400+ rows.  Each row is a separate report.  That is, what is on page 1 has nothing to do with what is on page 2 or page 1000.  I'm just dumping 1 row of data on one report  1400+ times. 

In each table row, I have the RGB values that I want to apply to that page only.  After I place the RGB values on the report and set them non-display, how do I combine the 3 values and set the background property?

Also, where can I find a list of properties I can modify?

Thanks much.
Cheers!



Replies:
Posted By: DBlank
Date Posted: 26 Jan 2009 at 12:29pm
Have a little trouble following you here but you can set the backgroud color of any section conditionally by:
select your Section Expert
click on on the section you want to format (e.g. Details)
click on the COLOR tab (on the right)
click the formula editor and insert your formula there.
I hope you have a table that has all of your color schemas with corresponding pages and you can use that in your formula.
you can use "Color (Rvalue,Gvalue,Bvalue)" as formula to set the color.


Posted By: rcflyer2005
Date Posted: 26 Jan 2009 at 1:19pm
Some Background:
This is not a production report.  It is a "means to an end" to get invoice data into pdf format.  It is just that some pages have a background color.  That is all.  It's not logical or it is supposed to make sense. 

The table contains test invoice data.  Most invoices are printed on white paper.  However, some vendors print their invoices on color paper.  I'm trying to simulate that.  Think of each page being an invoice a company has received from 1400+ vendors.  That's why the pages are not related.  When CR prints page 1, I want it to get the RGB values and make the background the values of RGB.  Do the same for page 2,3,...,page1400+.  Each row in the db is a page break. 

If I created a formula, what would I type in it?  If I put the RGB values on the report they would be fields colorR, colorG and colorB.  Or I can put the three values in one field, separated by a comma and use one field.

Sorry for the confusion!

thanks much!


Posted By: DBlank
Date Posted: 26 Jan 2009 at 1:37pm
So you have a table with vendor names and the colums for the R, B and G values that you can link to the invoice data on the vendor? If so what field type are the "color" columns.


Posted By: DBlank
Date Posted: 26 Jan 2009 at 2:12pm
If the above is accurate you can bypass dealing with page numbers and handle it based on your joins to the vendors. If you only have the vendors that use color in the "color table" you would need to handle instances where they are not listed. I have never tried this and don't really have good data for testing the process but this might work (replace the {table.field} with the appropraite fields from your color table):
if isnull ({colortable.vendorfield}) then crNoColor else Color (int({colortable.Rvaluefield}),int({colortable.Bvaluefield}),int({colortable.Gvaluefield}))



Print Page | Close Window