I have data coming from data base in crystal report by SAP with VS2010 SQLServer, displayed in text boxes since Crystal doesn't have data grids.
How can there I alternate the background colors of those text boxes?
I have data coming from data base in crystal report by SAP with VS2010 SQLServer, displayed in text boxes since Crystal doesn't have data grids.
How can there I alternate the background colors of those text boxes?
There are two ways that I do this. The first is the easiest but least robust. In the details section, you can just add a background color formatting formula like this:
if recordnumber mod 2 = 0 then crgray else crnocolor
The second is if you need more control over your formatting, say if you're not displaying the details section at all and just group footers/headers. It just involves keeping track of a single boolean variable. In the section that you want to flip-flop, add this to your background color formatting formula:
Create a custom formula; call it 'Colorize':
Add the following to the Detail section's Background Color conditional-formatting formula:
You can also use it with group header section by passing the GroupNumber keyword:
If you are doing anything fancy w/ grouping, you may want to use a running-total formula:
Add this formula to group-header section, then suppress it.
Change the grouper-header's conditional formula to:
To achieve this for text boxes. You are going to create a custom formula, I created "Toggle"
Then insert a text box and add the Toggle formula field. Then you will want to select the text box and format the text. Select the border tab and check the background box and in the custom formula editor add
Now your text box will toggle the background color on and off. There is one small issue though and that is you will see the text True or False. I fixed this by first selecting Edit Text... then select the text and right click for text formatting. I set the color of the text to white and the size to 1, then I changed the format of the Toggle text from true and false to T and F, this makes it basically non-visible. Also make sure to move your text box to the back. I use this method when I do not want or need the entire sections background to be changed and just a portion.