Ireport
versus
JasperReport
Development details
Author
: SSY8110 2005-04-25 (Download Full Document)
3.2.1
Design report
Now please click on the menu
"Datasource"
Then choose
"Report Query"
I can click the icon.
,
then
Ireport
A dialog box will pop up
(
Figure
)
:
Now we are
"Report SQL Query"
Input
SQL
Statement
"Select * from titles",
Then remove
"Automatically Retrieve Fields"
Front hook
,
Clicking
"Read Fields"
Read the data field in the table as shown
Click
"Ok"
back to main interface. Now the content of the design report, please click on the menu
"View"
Below
"Report Fields"
Item, you can also click on the icon on the toolbar.
, Then you will get all the fields in the table, as shown in the picture:
You can choose the column you want, drag it, will drag the first column to the report, so
Ireport
It will automatically bind the columns you drag.
(
Don't tell me that you won't drag this action, huh, huh
)
Here we only make simple plays, do not drag too much to list the report, we only choose to take
"Title_ID
,
Pubdate, Title "
Three columns can be. Of course, if you don't want to use this simple method, you have no way to add that, you can also click on the icon on the toolbar.
At this time your cursor will change
One ten shape, you can draw a place in any position of the report
The text box came out, because you painted a dynamic text column in the report, then you have to set its properties, you can double-click the text box you just draw, you can also click right click on the text box you draw. selected
"Properties"
. To set its properties. Figure:
Automatically turn automatically after opening the property window by default
Text Field
On the tab, you have to set a data type corresponding to the database,
This can't be wrong, otherwise it will be wrong when you compile or generate a report.
(
Not test, you can't make it wrong to appear in that step.
)
There is also one of us must pay attention to
Textfield Expression,
Default in its input box
"$ F {Field}"
At this time you have to put the braces
Field "
change
The column name to specify in your table. If you have to ask
$ F "
What is the representative, then you should look at the table below. After setting these two, you can bind a column data.
But you have to put it
"detail"
In the area, otherwise you may only display a record to the report when you run the report. Why don't you explain it! Empty page for the entire report
Ireport
I have been divided into you, such as
: "Title, PageHeader, ColumnHeader"
and many more.
element
name
Quote
variable
Variablesname
$ V {variablesname}
parameter
Parametername
$ P {parametersAme}
Field
Filedsname
$ F {filedsname}
Now I always feel a little monotonous.
,
We can set some of the information such as the title to the report, found in the toolbar
,
Click on it and then
"Title"
Channel painting a text box, double-click it or right click "Properties"
At this time, a static text box appears in the properties window, check
"Static text"
Tab, enter
"
Test report
"
,allowable
"Font"
Select the fonts and font numbers you want to see in the tab, as shown
Here you can also use it without input, you can also get data from the database to fill it,
"common"
Tab, click, you will see
"Print When Expression"
Enter the column name you want in its input box, the specific operation is as above, but also with the three-pointer icon from the right.
Go in, there are four types
"Fields, Parameters, Variables, Formulas"
Here is only the first two,
Fields
As already said in the previous, the specific operation is the same, no more, second
"Parameter"
This parameter is generally not
Ireport
Use it in it, follow. Then follow the settings
"Title"
Way to set
"Columnname"
After doing good, what you see is displayed, or garbled, what should I do? You can see the page
FAQ,
Now one of the most basic reports can be considered done, but have to adjust its location, and the boundary line of the up and down, otherwise, the data will be very zeroat when the data is displayed.
Save now, remember that it is best to save as the name when you create a new report. reason:
"
Errors will occur because the report is read in using the file stream and then compile. After saving, click the icon on the toolbar.
Compile, there are two icons on the toolbar, one is to perform a static report
The other is used to fill a dynamic report
,
Now we can only use the button executed by dynamic reports to fill the report, with the former to execute, in addition to your static text, other display
NULL
.
Ireport
In default
"JRVIEWER Preview",
The effect after the generation is:
You can also
"Build"
Select the report format you want to get in the menu, such as
: PDF, XSL, CSV, HTML
Wait
...
When you choose to run the running program that generates the report, it will save it by default.
Ireport
In the current directory, it will not be the directory where you save the report. If you don't like to watch an English interface, you can be on the menu
"Tools"
Below
"Options ..."
You can set the language, save location, backup location, procedures used by running reports, etc.
...
Last continued
FAQ
1.
What Chinese is garbled when generating a report?
JasperReport
Chinese processing, you must have an Asian language package
Itextasian.jar, "
Go
Ireport
Below
Lib
Directory; then modify report
"PDF FONT NAME"
Change it to
"STSONG-LIGHT",
Furthermore
"PDF Embedded PDF Encoding"
Change it to
"Unigb-ucs2-h (chinese simplified)",
This will solve this
JasperReport
Chinese problem
(
against
Set, right
Excel
Perhaps less, but this setting can also be displayed as Chinese, is not to be ignited)
.
2.
Report compilation
NoclassdefFoundException
abnormal
?
Processing
JasperReport
This exception occurs because it is referenced
JasperReport
Some of
jar
The file is incomplete, because the work is busy with my processing is
JasperReport
Directory
DEMO / SAMPLE / WebApp / Web-INF / LIB /
all
jar
File, full reference, to prevent me, and there is no time to go too much. There must be some unnecessary packages being referenced. If you have time to look at it, you will not be necessary.
jar
Remove.
3.
Save as
Appearing
Unisupportencodingexception
abnormal
?
There is a small error in the process of report design, because there is no change
"PDF FONT NAME"
Be changed to
"STSONG-LIGHT".
Download related
:
Ireport
download link:
http://ireport.sourceforge.net/
JasperReport
download link:
http://jasperreports.sourceforge.net/
IText
Asian language package download address:
http://www.lowagie.com/itext