on 01-23-2013 1:41 PM
I have following format in crystal reports
text1
text2
text3
i placed these all 3 fields in text field in crystal reports for proper alignment when they grow vertically,
my problem is that i need to change background color for text2 field,
how can i achieve this
i m using crystal reports for .net 2005
Hi,
if you have Textbox as [@text1@text2@text3], then got to design mode and double click on the Text Box and select the "Text2" >> rightclick>> format field and change the color.
Thanks,
Jothi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Asif,
as far as i know there is no ability to have different backgrounds in a text object. i.e. the background property is global. i am using cr 14.0.4.738 though so perhaps that's change in a recent patch.
you can change up the font by using rtf interpretation though in this & earlier versions of cr...create a new formula like below, change the stringvars to your field, and then Format the field > Paragraph > Text Interpretation > RTF. i know it's not the same as having the background change, but it may be a close substitute.
stringvar t1:= {Product.Product Name};
stringvar t2:= {Product.Product Class};
stringvar t3:= {Product_Type.Description};
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}" +
"{\colortbl ;\red0\green176\blue80;\red255\green255\blue0;\red255\green0\blue0;}" +
"{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\sa200\sl276\slmult1" +
"\cf1\lang9\f0\fs22" + t1 +
// cf1 references the first colour in the color table
// fs is the font size (rtf based)
// f0 is the font type in the font table
"\cf2" + t2 +
"\cf3" + t3 +
"\cf0\par}"
the rtf tag for background i believe is highlight which doesn't work in my version of cr.
jamie
hi Asif,
this was bothering me so i thought of another workaround for you that will emulate a different background for each field in the text object.
using your example of text1, text2, & text3 in your text object already:
1) create a new formula called text1b with syntax like
numbervar l:= length({text1});
replicatestring('█',l)
2) create new formulae similar to step 1 for text2 & text3
3) on your report change the font for the existing text object containing text1 to text3 to Courier New or any other fixed width font that you have that has an extended character set (i.e. one that has the 'full block' character in step 1)
4) create a new text object and use the format painter to make the new text object the same font as in step 3
5) drop your new formulae (text1b, text2b, text3b) into the new text object
6) now format the new formulae in the new text object one by one for the colour that you'd like to use as the background
if you see any gaps between the 'full block' character that is acting as the background, it's usually because of your print driver...if you set it to 'no printer' then those should go away.
i hope this helps,
jamie
In the design view you can do this as follows:
Insert your text object on the report design pane (enter text or what ever)
Right click on the text object
Select "Format Object"
Click on the "Border" tab
Select what ever background color you need
Notice the Conditional formatting button next to the background color drop down. This will let you choose a color on condition as the report runs.
Using your version of CR, this is all you can do. E.g.; there are no exposed APIs that will let you do this at runtime.
- Ludek
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response,
Actually problem is that these all 3 fields are embedded in one text field, and there is no option to change back gourd color for only 1 embedded field, as in my case field 2,please also note, i cannot use multiple sections here, as in parallel i already displaying some data.
Ahhh - I get ya. I don't think this is possible. But, one thing you may want to do, is ask over in the CR Design Space. Some really great people there and they may have suggestions / work-arounds and all that. Start with making the query generic (e.g.; don't mention crystal reports for .net 2005, just say Crystal Reports). A mention of .net makes a lot of people very shy ...
- Ludek
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.