Java open-source reports jasperreport and ireport4.5.1 (5) Table Components
After learning in the previous chapter, you have mastered the basic use of ireport.
This section describes how to use some useful components. One is table and the other is crosstab ).
. Table usage.
① Drag the table component into the report ,:
Examples are as follows:
In the summary section, the table is displayed!
② Create a dataset and set the number of columns in the table
Next step
There are two options: You can manually enter an SQL statement or design a query statement to design a query statement.
:
Next, select the required fields,
Select the group information. You can also add the group information when designing the report later.
Since then, dataset has been set up! :
After clicking finish, the table 1 tab is automatically displayed,
The page is as follows:
Switch to the table 1 Tab
③ The table designed.
There is a statistical field at the end,
Is to count all the number of people in each unit, the method is as follows, expression is as follows:
- $F{unitAthleteView_manAthlete}+$F{unitAthleteView_femalAthlete}+$F{unitAthleteView_guide}+$F{unitAthleteView_coach}+$F{unitAthleteView_teamDoctor}
Note: by default, the table does not have borders. To add borders, manually add borders as follows:
Select All static text and text
Field,
Right-click padding Add Borders
Set the following parameters.
The preview result is as follows: