I implemented a TOC into my report as described in the official Jasper Report examples.
It works well within the limitations mentioned in the example:
This operation has apparently only one inconvenience. The final document does not reflect the modification in the order of pages. You can see that in our sample, the table of contents does not display a page number on the footer and that the page #1 comes after the table of contents.
To work around this limitation I only need one thing: A variable (or whatever) which tells me how many pages the TOC has.
When assuming a one-page TOC I can just add 1 to current and total page numbers in the Page Footer of my document. Then my 20 page PDF would have the following pages:
Additionally I would need to add one to each Heading in the Heading subreport to correct my page numbers. But as my TOC can be longer then one page this is not an optimal solution.
Is there any way to do this?
I know this is an very, very old topic. But I stumbled on this topic while searching for something else and I just have to react on this, because it's an frequently asked feature and since version 6.0 implemented in a very easy way on Jasper Reports!
What they basically did was create a new sort of jrxml, which is the Workbook, which can contain cover, backcover, TOC (with more inteliggence then before) and content in the middle (which are other jrxml's)
Hope someone finds this helpfull
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With