Reputation: 121
I have a cross-tab in the report. I need to change background color of the summary field based on the database field HEX value. For this I'm interpreting field as HTML. So I created the formula fields and trying to use HTML tags to format it. I can change the font color OK, like this:
But I cannot figure out how to change the background color. I have a database field for this - {Report_SELECT_TagLayouts.BackgroundColorHex}, but even if I just use regular HEX values it doesn't work. I've tried different tags - div, span etc. - no luck.
I understand that Crystal reports support only limited number of HTML tags, but whatever I try is not working. Font color is fine.
I would appreciate your suggestions.
Upvotes: 0
Views: 2199
Reputation: 11
Unfortunately, you will need to convert your hex to rgb.
I would then go to then go to the border tab, click on the background X-2 in the Color box.
You would then place the your criteria (if x then color(r,g,b) else crNoColor
You will probably need to create a variable formula for the rgb conversion
i.g.
local numberVar R;
local numberVar B;
local numberVar G;
local stringVar convert;
convert =: R & "," & "," & B & "," & G;
if x then color(convert) else crNoColor
good news though is that someone has already done conversion math. http://www.rapidtables.com/convert/color/hex-to-rgb.htm
Upvotes: 1