是否可以使用 Jasper Reports 动态生成报告,而无需为每个报告生成 jasper?
我必须根据动态提供的各种参数生成报告。在某些情况下,参数可能为空。 例如,来自表 Person 的 id、name、age、sex和 maritalStatus 作为字段,我必须生成关于 30 岁已婚男性的报告。有时,可能会要求与女性结婚而不考虑年龄。如果我在这两种情况下使用相同的碧玉,则在第二种情况下年龄约束将为空。有什么方法可以控制这种情况吗?
另外,是否可以动态指定报告中应生成哪些所有字段?
I have to generate reports based on various parameters which would be provided dynamically. In certain contexts, the parameters may be null.
For example, from the table Person with id, name, age, sex and maritalStatus as fields, I would have to generate reports on married male persons of age 30. Some other times, it may be required to get married female without considering age. If I use the same jasper for both these cases, the age constraint will be null in second case. Is there any way to manage this condition?
Also, is it possible to dynamically specify which all fields should be produced in the report?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用JasperReport API动态生成报告的示例:
您可以在<中找到更多示例强>%JasperReportsFolder%/demo/samples 文件夹href="http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%204.1.3/jasperreports-4.1.3-project.zip/download" rel="noreferrer">JasperReports 分发包 。
The sample of using the JasperReport API for generating report dynamically:
You can find more samples in %JasperReportsFolder%/demo/samples folder from the JasperReports distribution package.
您应该尝试动态碧玉。这正是动态碧玉所设计的用例类型。您可以使用相同的模板生成具有不同列的报告。
欲了解更多信息:http://dynamicjasper.com/
You should try Dynamic jasper. This is exactly the type of use case the dynamic jasper is designed for. You can use same template to generate reports with different columns.
For more info : http://dynamicjasper.com/