Current versions: ireport 1.2.2, jasperreport 0.9.2
A friend named "QQ master" one day ago asked me a question about ireport and wanted to post a tutorial. For those who wanted to use report tools, refer
In fact, we only use jasperreport for reporting. ireport is a visual development tool of jasperreport.
At present, there is almost no Chinese introduction to their Integrated DevelopmentArticleEven so, I am not going to introduce them in detail. Here I will only write some of my experiences, but there are some places for me to come over, if you want to study them carefully, read the English documents of the covers.
The relevant jasperreport documentation is very detailed. This document is charged, but there are electronic versions circulating on the Internet. I am lucky to get a copy. If you need it, you can go to your site (
Http://plateau.sicool.com), thanks to jasperreport for its contribution to the open source world.
On the contrary, there are not many ireport documents. Maybe the author thinks it is simple enough. I also have some development experience after numerous explorations.
Well, let's go into the process of integrated development reports between the two ......
1. First, you need to get their latest versions. You can download them at the address below.
Irport: http://ireport.sourceforge.net
Jasperreport: http://jasperreports.sourceforge.net
Their configuration is also very simple:
After port is decompressed, edit the ireport. BAT file in the directory, as shown below:
@ Echo off
Set java_home = C:/jdk14
Set ant_home = D:/ant
Set ireport_home = C:/documenti/Progetti/ireport/ireport2/
REM % ant_home %/bin/ant javadocs
% Ant_home %/bin/ant ireport
Is it easy? You only need to set the corresponding routes. Here ant is used for running. Of course, if ant is not installed
If you do not want to install it, you can do the same. But here I am buying an official account. You can find the corresponding running method in the decompressed directory. Install ant.
Jasperreport does not require any configuration. You only need to put the downloaded jar package under classpath. It's easy to say, but if there is no ireport
For us to do "dirty work", then what will be the pain of the report work ~!
2. How does jasperreport work?
Here I will talk about it in a simple way.
First, we need to first have an XML file and then compile it into a Jasper file (ending with. Jasper). What we really want to use is the compiled. Jasper file, which is similar to the familiar. jsp file.
File, in fact, we call its compiled servlet.
(Picture from http://ireport.sourceforge.net/cap3.html#3.1)
However, static reports have no meaning, so there is a good saying:
"A datasource + A Jasper = a print"
It supports the following output formats: PDF, HTML, XML, xls, CVS, and so on.
Therefore, the original input of jasperreport is A. XML document. Imagine that there are hundreds of lines of XML files in a simple report, without ireport
How painful it was to use it for reports. (What makes me incredible is that one of my classmates once used jasperreport for reporting, but they didn't actually use ireport, day !)
Now you don't have to worry about it. You can use ireport to easily handle this XML. Here, I think of struts_config.xml, and there have been many visual editors about it.
If you want to prepare a report before ireport, you need to spend a long time to familiarize yourself with the jasperreport document. One purpose of this document is to compile the XML
File. Now you only need to familiarize yourself with ireport when you are familiar with the document.
The above is just an introduction to a friend who doesn't know ireport at all, in order to let you learn from scratch to make reports. If you have a foundation, you just need to read the following ..
For details, refer to the Flash tutorial below. I was able to use it for the test yesterday. I can see it all. It's very specific. It's all clear after reading it:
1.Setup a new datasource
2.The Report Wizard
3.Ireport/jasperreports files
4.Formatting Fields
5.Groups
6.Parameters
7.Subreports
After watching the above animation, if you are not clear about it, please follow the post to ask questions.