Jump to content
JasperReports Library 7.0 is now available ×

enable bookmark for reports


wangyi

Recommended Posts

Hello friends,

 

I am using jasper1.0.2 version to generate PDF reports. I would like to enable bookmark feature. I can make bookmark work well, however, it does not work as what I expected. The testing scenario is:

 

1) I am going to generate reports for 100 users.

2) Each report for each user has 7 pages.

 

My first implementation is:

 

1) enable bookmark level 1 for the report.

 

The result is:

 

1) The report has 700 level "1" bookmark.

 

What I want is:

 

1) The report should have only 100 level "1" bookmark.

2) Under bookmark "1" level, we should have second level bookmark.

 

 

The overall idea is to present bookmark as the tree.

 

1st bookmark for user level.

2nd bookmark for report content if there are more than one page.

 

Could someone give me some hints?

 

Thanks very much.

 

Yi

Link to comment
Share on other sites

  • 2 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Ideally, you should be able to set a variable that increments and resets on group/subgroup boundaries. You could then use that to do the first page of the level (that is a print condition). You might want to create put a copy of the variable/field in the appropriate band, make it invisible by setting background color to foreground color, and using the aforementioned variable to determine when to do this.

 

Unfortunately, I found that after the first initialization of a variable being reset on a group boundary (and using an increment of 1 on a page boundary), it resets the variable to NULL. I worked around this using a scriptlet and setting the variable to zero (essentially resetting it to the initial value) in the afterGroupInit() call...

 

Look in the source files under demo/scriptlet for some good sample code. That's that zip file you can download with jasperreports...

 

Kinda clunky...but it works...

 

One thing to do with a scriptlet to make your life easy (other than getting the eclipse plug-in for iReports) is to compile it and put it in a jar, and add that jar to the CLASSPATH of the iReport tool. You'll typically get a ClassNotFound message when you save the .jrxml but it will go away when you compile it.

 

Hope this points you in a good direction...

Link to comment
Share on other sites

  • 9 years 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...