Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Changing colour of hyperlinks
mennovh
<p>Hi,</p><p> </p><p>I am working on a report where I have a different style for each group level in a report.</p><p>So for example Group Header 1 has a dark background with white text. Within these group the first column contains a value that has a hyperlink to a new report / drilldown. However when Birt renders hyperlinks the colour is always set to the default blue which can clash with the background colour.</p><p> </p><p>I have come up with the following script on the 'onRender' of the field that has the hyperlink to force the correct colour from the style in the library but was wondering if there is an easier/better way to do this:</p><p> </p><p>importPackage(Packages.java.lang);</p><p>importPackage(Packages.org.eclipse.birt.report.model.api.util);</p><p> </p><p>temp = reportContext.getDesignHandle().findStyle("table-group-header-1").getProperty(StyleHandle.COLOR_PROP); //gets the colour of the font from the style but is a decimal colour code.</p><p> </p><p>r = Math.floor(temp/65536); //get the red value</p><p>g = Math.floor((temp-256*256*r)/256); //get the green value</p><p>b = temp -r*256*256 - g*256; //get the blue value</p><p> </p><p>r2=Integer.toHexString( r );</p><p><strong class='bbc'>if</strong> (r2.length() < 2) {r2="0" + r2} ; //need to add leading 0 if low value to get double digit value.</p><p> </p><p>g2=Integer.toHexString(g);</p><p><strong class='bbc'>if</strong> (g2.length() < 2) {g2="0" + g2} ;</p><p> </p><p>b2=Integer.toHexString( b );</p><p><strong class='bbc'>if</strong> (b2.length() < 2) {b2="0" + b2} ;</p><p> </p><p>hex = "#" + r2 + g2 + b2</p><p> </p><p><strong class='bbc'>this</strong>.getStyle().color = hex</p>
Find more posts tagged with
Comments
There are no comments yet