Jump to content

HTML Code in Crystal Reports


ChrisP

Recommended Posts

Hello - I am completely new to the world of HTML but need some help with what I'm hoping will be a very simple solution. Advanced conditional formatting in Crystal Reports requires some HTML code to be added. In a nutshell I am trying to make the word 'Fox' appear in red, bold font with a yellow background - the word fox is just one word that will appear in a whole text string. I currently have the following code that produces the text in red and bold but I cannot get the yellow background to work. Some of the syntax below may appear weird but that may just be the Crystal requirement. Hope this makes sense? StringVar SearchText := "fox";StringVar Htm1 := "<b><font color='red'>";StringVar Htm2 := "</font>";

Link to comment
Share on other sites

I don't recognize this language. I guess it's what you're calling "Crystal"You forgot a closing <b> tag, and <font> is deprecated. You should use CSS instead:

StringVar Htm1 := "<span style='font-weight: bold; color: red; background-color: yellow'>";StringVar Htm2 := "</span>">;

Link to comment
Share on other sites

Thanks for that. As I mentioned above, I am very, very new to this so will look at the CSS option although what you suggested after a bit of tweaking only produced red font not bold and yellow highlight (background). The code below is at least giving me bold and red so it's a start and if anyone knows if it's possible to extend that to include yellow highlight (background colour) then that would be just great. Thanks StringVar SearchText := "fox";StringVar Htm1 := "<b><font color='red'>";StringVar Htm2 := "</b></font>";

Link to comment
Share on other sites

The code I gave you will do it. There's no HTML that will give you a background color to inline text. CSS is required to style pages. Your closing </b> tag should be after the closing </font> tag.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...