Jump to content
We've recently updated our Privacy Statement, available here ×

Including image in textField element


padmav

Recommended Posts

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

  • 4 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...