padmav Posted November 5, 2009 Share Posted November 5, 2009 Hi,I have the following textField element in my jasper report template. I would like to add an icon to the text filed. In my case, when $F{VolumeChange}.longValue() < 0, then I would like to add an up_arrow.jpg that should be shown together with the textFieldExpression like the following. If I put the image as part of the textFiledExpression it is giving error. Can you please let me know if there is there a way to do this?---------- <textField isStretchWithOverflow="true"> <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="95" y="0" width="70" height="15" forecolor="#CC0033"> <printWhenExpression><![CDATA[new Boolean($F{VolumeChange}.longValue() < 0)]]></printWhenExpression> </reportElement> <box leftPadding="10" rightPadding="10"/> <textElement textAlignment="Right"> <font size="8" isBold="true"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["-" + Math.abs($F{VolumeChange}.longValue()) + " (" + $F{VolumeChangePercent} + ")"]]></textFieldExpression> </textField> -------- Image I would like to add is up_arrow.jpg : ![CDATA[ <image scaleImage=Clip"> <reportElement x="95" y="0" width="10" height="15" isRemoveLineWhenBlank="true"/> <imageExpression class="java.lang.String"><![CDATA["../images/up_arrow.jpg]]></imageExpression> </image> ]]----Thanks,Padma Link to comment Share on other sites More sharing options...
lucianc Posted December 3, 2009 Share Posted December 3, 2009 You can't do that, you'll have to create the image as a separate element and control it using its print when expression.Regards,Lucian Link to comment Share on other sites More sharing options...
padmav Posted December 4, 2009 Author Share Posted December 4, 2009 Thank you for your reply. Padma Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now