Home
Analytics
Setting background Image based on Data
vensw
Hi All,
I'm using an XML file as my Data Source and I have to read an attribute from it and depending on that attribute's value, I have to set the background image of my report. Can anyone help me regarding this.
To be more clear..
My XML file looks some thing like
<report name="XYZ", image="draft" ......>
.
.
.
.
</report>
Since the image attribute has the value of "draft", I have to set the backgound image of my report to "draft_image.png". If I have the value of image attribute as "test", I have to set the background image of my report to "sometest_image.png". How can I do that? and where should I keep my "draft_image.png", "sometest_image.png" file(s)?
Regards,
EVSGK.
Find more posts tagged with
Comments
mcremer
HI Vensw,<br />
<br />
Welcome to our community. What you were looking for was in the <a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/'>DevShare</a>section:<br
/>
<br />
The link go's 2:<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1292-watermark-examples/'>http://www.birt-exchange.org/org/devshare/designing-birt-reports/1292-watermark-examples/</a><br
/>
<br />
The blog that tells you about it in more detail:<br />
<a class='bbc_url' href='
http://birtworld.blogspot.com/2010/12/birt-backgroundwatermark-images.html'>http://birtworld.blogspot.com/2010/12/birt-backgroundwatermark-images.html</a><br
/>
<br />
A quick glance tells me that it has some quirks because its in the watermark is set at generation phase so there could be some problems if you want to read your data first. But I hope this answers your question.
vensw
Hi mcremer,
Thank you so much for the reply. The above example illustrates dynamic watermark based on the format of the report. It doesn't say anything about how to read the data element from the XML file or a property value from the property file to achieve the dynamic watermark. Could you let me know if you have any solution for it?
Thanks!!
EVSGK.
mcremer
<blockquote class='ipsBlockquote' data-author="'vensw'" data-cid="84752" data-time="1320156428" data-date="01 November 2011 - 07:07 AM"><p>
Hi mcremer,<br />
<br />
Thank you so much for the reply. The above example illustrates dynamic watermark based on the format of the report. It doesn't say anything about how to read the data element from the XML file or a property value from the property file to achieve the dynamic watermark. Could you let me know if you have any solution for it?<br />
<br />
Thanks!!<br />
EVSGK.<br /></p></blockquote>
As far as I know thats not posible if you look at the <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php'>http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php</a>
; and read the blog postyou see that the event is DONE before the data objects come in exsistance.
vensw
<blockquote class='ipsBlockquote' data-author="'mcremer'" data-cid="84753" data-time="1320157093" data-date="01 November 2011 - 07:18 AM"><p>
As far as I know thats not posible if you look at the <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php'>http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php</a>
; and read the blog postyou see that the event is DONE before the data objects come in exsistance.<br /></p></blockquote>
<br />
Hi mcremer,<br />
<br />
Here is some work I have done so far and it almost worked with one small problem.<br />
<strong class='bbc'>I tried reading a property (showWaterMark) in the properties file (testtemplate.properties)</strong> and based on that property, I <span style='color: #FF0000'>tried changing the watermark dynamically</span>.<br />
<br />
Sample code looks like..<br />
<br />
<span style='color: #006400'>importClass(java.io.File);<br />
importClass(java.io.BufferedReader);<br />
importClass(java.io.InputStreamReader);<br />
importClass(java.io.FileInputStream);<br />
importClass(java.util.Properties);<br />
<br />
file = new File("C:\testtemplate.properties");</span><br />
<span style='color: #FF0000'>// file = new File("testtemplate.properties");</span><br />
<span style='color: #006400'>try {<br />
waterMarkProperty = new Properties();<br />
waterMarkProperty.load(propertiesStream);<br />
property = waterMarkProperty.get("showWaterMark");<br />
if (property.equalsIgnoreCase("true")) { <br />
this.getMasterPage("Simple MasterPage").getStyle().backgroundImage = "watermark_yes.png"; <br />
} else { <br />
this.getMasterPage("Simple MasterPage").getStyle().backgroundImage = "watermark_no.png";<br />
}<br />
} catch(exception) {<br />
<br />
} </span><br />
<br />
The watermark images were placed in the Resource Folder. But the <strong class='bbc'><span style='color: #FF0000'>problem is I'm specifying the absolute path of the properties file to read the property from</span></strong>. What needs to be done to read the properties file from the Resource folder(If I add the properties file in Resource folder)?
vensw
Any help??? <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/confused.gif