Read the jrxml file to generate the jasperreport subreport. the JavaBean is used as the data source.

Source: Internet
Author: User

1) Add the package name, such as COM. blog. userbean. enter the class name directly and cannot find it. you can also manually add a field on the design or XML interface to modify attributes.

2) Two methods are adopted for JavaBean subreports. One is the subreport as the parameter and the type is jasperreport. The two reports can be compiled independently. I can only use jrxml to compile in memory. the compiled Jasper file cannot be used (the error is not resolved ). you can read jrxml from the database and export reports without writing them to disks. 2. The sub-Report path is used as a parameter. If the parent report is compiled, the sub-report is loaded and no compilation error is reported. you can use both jrxml and Jasper. however, the sub-Report path must have compiled sub-reports. The disadvantage is that you need to write the sub-Report to the disk and then load it to export the report.

 

Pay attention to the above two points and search for information on the Internet.

Tip:

1. it must be a jar package. It is not required if the groovy-all program does not report an error. some fonts in the PDF report generated by jasperreport4.0.2.jar may overlap, and "" can be added later to solve this problem, causing a headache. when 3.7.6 is used, there will be no overlapping fonts.

Itext. Jar Note: The other jar packages do not exist. If the error message is missing, you will find that the jar package is missing. However, itext reports an error.

Error [stderr] net. SF. jasperreports. Engine. jrexception: org. xml. Sax. saxparseexception: XML document structures must start and end within the same entity. noclassdeffounderror

Or ** error can't cast to exception... Or xmlparser..., the error message is uncommon and should not be found.

2. The ireport version is different. The higher version can parse the jrxml file of the lower version. On the contrary, an error is reported, which is uncommon,Note that ireport and jasperreport support the jar package version of jasperreport.Someone on the Internet said that experts can write jrxml tag development reports, and the tools are mainly debugging. I encountered all the strange problems. For example, if the text content is HTML, the required PDF can be parsed to HTML, and the font and color will be displayed. the example on the design page is the same as that in the sample. You cannot parse HTML to display the font effect, and then view the jrxml tag,
It is really different. According to the usage in the sample, you can parse the HTML tag to display the font effect.

 Don't work!! <textElement markup="html"><font fontName="Arial"/></textElement>Work:!!<textElement markup="html"/>

FAQ:

1: net. SF. jasperreports. Engine. jrexception: java.net. malformedurlexception: NULL in dB

2: 10:29:39, 130 info [stdout] [2011-11-01 10:29:39. 115] Parse error at line 33 column 30: cvc-complex-type.3.2.2: attribut
E 'splittype' is not allowed to appear in element 'band '.
Org. xml. Sax. saxparseexception: cvc-complex-type.3.2.2: attribute 'splittype' is not allowed to appear in element 'band '.
<Band splittype = "stretch"/>==>>< band height = "0" issplitallowed = "true"> </band> I don't know which jar package version is low, only the earlier version 1.2.3 can be used. the ireport label.

3: blank between detail and Column Foot.

Resolve: delete Column Foot and use group foot and set select expression: "1 ";

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.