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 table components into the report,:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249121333-0.jpg "/>
Examples are as follows:
In the Summary section, the table is displayed!
② Create a dataset and set the number of columns in the table
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249124334-1.jpg "/>
Next step
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/12491242B-2.jpg "/>
Set dataset data sources or links
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/124912H39-3.jpg "/>
There are two options: You can manually enter an SQL statement or Design a query statement to Design a query statement.
:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249122303-4.jpg "/>
Next, select the required Fields,
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249121921-5.jpg "/>
Select group information,You can also add a report later.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249121c2-6.jpg "/>
Since then, dataset has been set up! :
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249125606-7.jpg "/>
After clicking finish, the table 1 tab is automatically displayed,
The page is as follows:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249122R4-8.jpg "/>
Switch to the Table 1 Tab
③ The table designed.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249124122-9.jpg "/>
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.: Perform the following operations:
Select AllStatic TextAndText Field,
Right-clickPadding Add Borders
Set the following parameters.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1249121213-10.jpg "/>
The preview result is as follows:
650) this. width = 650; "border =" 0 "alt =" "src =" http://img1.51cto.com/attachment/201205/215139783.jpg "/>
This article from the ghost Conan technology blog, please be sure to keep this source http://enetq.blog.51cto.com/479739/863354