开发者

Exception when Importing JasperReport to from iReport to Java application

开发者 https://www.devze.com 2023-03-25 01:33 出处:网络
I\'m trying to import a moderately complex report into my java application. The report includes subqueries, a style template (jrtx) and images. Everything works great in iReport but when I try to run

I'm trying to import a moderately complex report into my java application. The report includes subqueries, a style template (jrtx) and images. Everything works great in iReport but when I try to run the report in the application it gives me the following error:

exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is net.sf.jasperreports.engine.JRRuntimeException: Error parsing template XML

root cause
net.sf.jasperreports.engine.JRRuntimeException: Error parsing template XML

root cause
org.xml.sax.SAXParseException: Element type "paragraph" must be declared.

I'm using iReport version 4.0.2 (with 4.0.1 compatiblity mode on) to develop the reports and net开发者_如何学编程.sf.jasperreports 4.0.1 to run the reports on my application. NOTE: iReport versions match up to jasperReport versions.


Apparently, iReport's 4.0.1 compatiblity mode does not work 100%. iReport 4.0.2 inserts a tag when messing with certain properties. The <paragraph> tag doesn't exist in JasperReport 4.0.1. I would have caught this at compile time if I had embedded any paragraph styles in the report rather than the style template. Templates are considered at run-time.

I converted my templates like this:

From:
<jasperTemplate>
...
  <style name="in-detail-fields">
    <paragraph leftIndent="3" rightIndent="3"/>
  </style>
...
</jasperTemplate>

To:
<jasperTemplate>
...
  <style name="in-detail-fields" leftIndent="3" rightIndent="3" />
...
</jasperTemplate>

Unfortunately, iReport 4.0.2 doesn't interpret the template correctly after changing the template like this. :-(. A better solution might be to downgrade iReport to the proper version.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号