[GuideFirst you need to install ant, and note that you should not forget to set path in path, for example, if the ant installed in my system is D:\apache-ant-1.6.2, then set the environment variable in path. Next is download Jasperreport, download that with demo, will he decompression, so early work completed. Open \jasperreport\demo Amples, here is the official offer of all the examples: 1. Alterdesi
First you need to install ant, and note that you should not forget to set path in path, for example, if the ant installed in my system is D:\apache-ant-1.6.2, then set the environment variable in path. Next is download Jasperreport, download that with demo, will he decompression, so early work completed.
Open \jasperreport\demo Amples, here is the official offer of all the examples:
1. Alterdesign
Using Ant to run this example shows the overall workflow of Jasperreport, while showing how PDF files are generated, background color control, and so on. First of all, to understand how Jasperreport works, it is based on XML files, (used ireport know, it is used to generate this XML file), so under Alterdesign, We just need to keep Alterdesignapp.java (this is the Java source file, needless to say); Build.xml This is what ant needs to use, about how the file is written, I think should not rote, if you want to use, find a template copy on the line, or look at the HTTP ://dev.csdn.net/develop/article/65/65567.shtm know a probably on the line; Alterdesignreport.jrxml, this is the XML file that we just said, this is also necessary. We can delete the rest of the documents (note that alterdesign), that is to say, our example wins 3 files. Now that you're using ant, go to the directory at the command prompt, and start by typing the ant javac. You don't need me to say, compile this Java file, now you have a. class; the second step is to use the ant compile, which is actually called compiling, It's the Jasperreport engine that compiles that XML file, generates something that's counter polish, which we don't care about, as long as we see a alterdesignreport.jasper build. The third step is to type ant fill, as the name suggests, the fill of the report, Generated Alterdesignreport.jrprint last step ant pdf or ant view or ant print, the previous one is to generate a PDF file, the middle one is in swing form preview, the latter is to call the print interface. Well, the whole workflow is clear. Now we can see the Alterdesignapp.java, really at a glance.