Jump to content

Manipulating JasperDesign


tah

Recommended Posts

Hello,

I need to dynamically change my report design by doing the following:

1- removing a text field from the detail band

2- replacing it with one or more other text fields

3- adding the necessary fields to match the text fields

 

Step 3 can easily be done with myJasperDesign.addField(myJRField).

However the closest I can get to doing the first two points is to find the JRDesignTextField in my detail band (myJasperDesign.getDetail().getElements()) but I can't remove it nor add anything else to the detail band.

 

Any help would be appreciated.

-Salah

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Can't you use the: printwhen expression from your texftield?

 

<printWhenExpression>

<![CDATA[new Boolean($V{VERSCHIL}.doubleValue() < 0)]>

</printWhenExpression>

 

So if my variable VERSCHIL<0 my textfield will be printed. If not, it won't be printed :)

Link to comment
Share on other sites

tah wrote:

However the closest I can get to doing the first two points is to find the JRDesignTextField in my detail band (myJasperDesign.getDetail().getElements()) but I can't remove it nor add anything else to the detail band.

 

getDetail() will return a JRDesignBand instance when called on a JasperDesign object, so cast it to JRDesignBand and you will find methods for adding and removing report elements.

 

HTH,

Lucian

Link to comment
Share on other sites

Thank you very much Lucian that is exactly what I needed. I'll get to it right away.

 

And thank you too Giroe but that is not what I was looking for. I have to change the whole detail band and add some new fields that I did not know about at design time :)

 

-Salah

Link to comment
Share on other sites

  • 1 year later...

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...