在JasperReports中直接嵌入子报表 [英] directly embedded subreport in JasperReports

查看:302
本文介绍了在JasperReports中直接嵌入子报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常接近这项工作,我试图直接将一个jasper子报告嵌入到另一个的主报告xml中。你认为这很容易,但我找不到一个例子。每个人似乎都使用文件或资源或其他任何东西。我有一个直接从字符串工作的报告,我希望它包含它的子报告。

I am so close to having this work, I am trying to directly embed one jasper subreport into the main report xml of the other. You'd think this would be easy, but I can't find a single example on doing it. Everyone seems to use files or resources or whatever. I have one report working straight from a string and I want it to contain it's subreport.

任何人?句法?谢谢!

推荐答案

我知道使用JasperReports执行此操作的唯一方法是为子报表使用单独的.jrxml文件,并使用子报告命令将其包含在主报告中。

The only way I know of to do this with JasperReports is to use a separate .jrxml file for the subreport, and include it in the main report using the subreport command.

您对任何嵌入式报告的另一个选择是使用子数据集,但据我所知它们只对图形有用。

Another option you have for any embedded reports is to use subdatasets, but as far as I know they're only useful for graphs.

因为听起来你控制了报告生成的代码,你可能会来使用简单的格式在一个字符串中定义多个报表,然后让代码在运行时提取每个报表。

As it sounds like you control the code surrounding the generation of the report, you could come up with a simple format to define multiple reports in the one string, and then have your code extract each report at runtime.

当我们需要处理单个报表时文件,但有JasperReport的子报告,我们使用Zip文件,只是压缩主报告和所有必要的子报告,然后在我们需要时将它们解压缩到一个临时目录(当然所有代码)

When we've needed to deal with a single file but have subreports for a JasperReport, we've used Zip files, and simply zipped up the main report and all it's necessary sub reports, and then unzipped them into a temporary directory when we need to (all in code of course)

这篇关于在JasperReports中直接嵌入子报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆