cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Font Colour of Part of a String

former_member292966
Active Contributor
0 Kudos

Hi,

I have a formula that builds a string like:

Folder1 >> Folder2 >> Folder3

This string can have up to 10 folders and the string can be multiple lines depending on how long the folder names are. To make the entire path a little easier to read I want to change the colour of the >> symbols.

The colour functions (color, RGB, crRed, etc.) don't work in a regular formula. Conditional formulas will change the font of the entire string.

Any suggestions?

Thanks,

Brian

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Brian,

How about inserting a text box and drop each {Folder 1} >> {Folder 2} >> {Folder 3} >> {Folder 4} Then highlight the >> right click and select format and change the color.

You may have to use multiple formulae of course but you know that...

Have fun

Don

0 Kudos

Oh and I found another way by using HTML Tags in Crystal Reports. How to is listed in the Knowledge Base Article [1217084|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313337333033383334%7D.do].

Sample attached ( I hope )

Thanks again

Don

former_member292966
Active Contributor
0 Kudos

Hi Don,

HTML is an interesting suggestion. I couldn't download the attachment but that's probably a security thing here at the university. I'll try when I get home.

Thanks,

Brian

Go Canucks

former_member292966
Active Contributor
0 Kudos

Hey Don,

Sweet that worked. There really isn't a whole lot of documentation on how to do this so the sample helped a lot. I copied my formula here for others to see.

StringVar FolderMapping; 
StringVar Parent1 := ""; 
StringVar Parent2 := ""; 
StringVar Parent3 := ""; 
StringVar Parent4 := ""; 
StringVar Parent5 := ""; 
StringVar Parent6 := ""; 
StringVar Parent7 := ""; 
StringVar Parent8 := ""; 
StringVar Parent9 := ""; 
StringVar Parent10 := ""; 

//build the first title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent1_title} LessThanGreaterThan "" Then 
    Parent1 := {sfu_get_contracts_sp;1.Parent1_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent1 := ""; 

//build the second title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent2_title} LessThanGreaterThan "" Then 
    Parent2 := {sfu_get_contracts_sp;1.Parent2_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent2 := ""; 

//build the third title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent3_title} LessThanGreaterThan "" Then 
    Parent3 := {sfu_get_contracts_sp;1.Parent3_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent3 := ""; 

//build the fourth title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent4_title} LessThanGreaterThan "" Then 
    Parent4 := {sfu_get_contracts_sp;1.Parent4_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent4 := ""; 

//build the fifth title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent5_title} LessThanGreaterThan "" Then 
    Parent5 := {sfu_get_contracts_sp;1.Parent5_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent5 := ""; 

//build the sixth title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent6_title} LessThanGreaterThan "" Then 
    Parent6 := {sfu_get_contracts_sp;1.Parent6_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent6 := ""; 

//build the seventh title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent7_title} LessThanGreaterThan "" Then 
    Parent7 := {sfu_get_contracts_sp;1.Parent7_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent7 := ""; 

//build the eighth title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent8_title} LessThanGreaterThan "" Then 
    Parent8 := {sfu_get_contracts_sp;1.Parent8_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent8 := ""; 

//build the ninth title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent9_title} LessThanGreaterThan "" Then 
    Parent9 := {sfu_get_contracts_sp;1.Parent9_title} & '<font size="10" face="arial" color="red"> >></font>' 
Else Parent9 := ""; 

//build the tenth title with html formatted delimiter
If {sfu_get_contracts_sp;1.Parent10_title} LessThanGreaterThan "" Then 
    Parent10 := {sfu_get_contracts_sp;1.Parent10_title} 
Else Parent10 := ""; 

//Build the string 
FolderMapping := Parent1 & 
                Parent2 & 
                Parent3 & 
                Parent4 & 
                Parent5 & 
                Parent6 & 
                Parent7 & 
                Parent8 & 
                Parent9 & 
                Parent10; 

FolderMapping := RTrim (FolderMapping); 

//If there is a close tag at the end of the string remove the entire html tag for the last delimiter
If Right (FolderMapping, 7) = "</font>" Then 
    FolderMapping := FolderMapping [1 to (Length (FolderMapping) - 51)] 
Else FolderMapping;

Replace LessThanGreaterThan with the symbols.

Make sure you format the field and set the Paragragh Text interpretation to HTML Text.

Thanks,

Brian

Answers (0)