 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS |
 |
 |
 |
Orders Report |
 |
 |
Here is a simple example that shows how to create a table of contents for your report. There are various ways to build tables of contents. Just let free your imagination and be creative, because JasperReports is very flexible and won't let you down. Most of the time you will end up using scriptlets and subreports, like we have in this sample. Note, that normally, the table of contents is generated as the report itself is being built. In this sample, it is generated using a subreport placed on the master report summary section and using data prepared by the master report scriptlet object. After the report is generated, the table of contents appears at the end of the master report, as you would expect after checking the report design. But the parent application performs a trick or a hack, or whatever you want to call it to remove the table of contents from the end of the document and insert it at the beginning. 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. |
 |
 |
 |
Table of Contents |
 |
 |
 |
Letter A |
___________________________________ |
1 |
 |
 |
 |
Argentina |
. . . . . . . . . . . . . . . . . . . |
1 |
 |
 |
 |
Austria |
. . . . . . . . . . . . . . . . . . . |
1 |
 |
 |
 |
Letter B |
___________________________________ |
2 |
 |
 |
 |
Belgium |
. . . . . . . . . . . . . . . . . . . |
2 |
 |
 |
 |
Brazil |
. . . . . . . . . . . . . . . . . . . |
3 |
 |
 |
 |
Letter C |
___________________________________ |
6 |
 |
 |
 |
Canada |
. . . . . . . . . . . . . . . . . . . |
6 |
 |
 |
 |
Letter D |
___________________________________ |
7 |
 |
 |
 |
Denmark |
. . . . . . . . . . . . . . . . . . . |
7 |
 |
 |
 |
Letter F |
___________________________________ |
7 |
 |
 |
 |
Finland |
. . . . . . . . . . . . . . . . . . . |
7 |
 |
 |
 |
France |
. . . . . . . . . . . . . . . . . . . |
8 |
 |
 |
 |
Letter G |
___________________________________ |
10 |
 |
 |
 |
Germany |
. . . . . . . . . . . . . . . . . . . |
10 |
 |
 |
 |
Letter I |
___________________________________ |
14 |
 |
 |
 |
Ireland |
. . . . . . . . . . . . . . . . . . . |
14 |
 |
 |
 |
Italy |
. . . . . . . . . . . . . . . . . . . |
15 |
 |
 |
 |
Letter M |
___________________________________ |
16 |
 |
 |
 |
Mexico |
. . . . . . . . . . . . . . . . . . . |
16 |
 |
 |
 |
Letter N |
___________________________________ |
17 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
Table of Contents |
 |
 |
 |
Norway |
. . . . . . . . . . . . . . . . . . . |
17 |
 |
 |
 |
Letter P |
___________________________________ |
17 |
 |
 |
 |
Poland |
. . . . . . . . . . . . . . . . . . . |
17 |
 |
 |
 |
Portugal |
. . . . . . . . . . . . . . . . . . . |
17 |
 |
 |
 |
Letter S |
___________________________________ |
18 |
 |
 |
 |
Spain |
. . . . . . . . . . . . . . . . . . . |
18 |
 |
 |
 |
Sweden |
. . . . . . . . . . . . . . . . . . . |
18 |
 |
 |
 |
Switzerland |
. . . . . . . . . . . . . . . . . . . |
20 |
 |
 |
 |
Letter U |
___________________________________ |
20 |
 |
 |
 |
UK |
. . . . . . . . . . . . . . . . . . . |
20 |
 |
 |
 |
USA |
. . . . . . . . . . . . . . . . . . . |
22 |
 |
 |
 |
Letter V |
___________________________________ |
26 |
 |
 |
 |
Venezuela |
. . . . . . . . . . . . . . . . . . . |
26 |
 |
 |
 |