为什么Jasper Reports在服务器中显示空报告,但在jasper studio中正确生成 [英] Why Jasper Reports shows empty report in server, but generates correctly in jasper studio
问题描述
我使用的是Jasper Studio 6.6.0和Jasper服务器7.1。
I am using Jasper Studio 6.6.0 and Jasper server 7.1.
我创建了一个包含指定网址图片的简单报告。
I have created a simple report with an image from a specified URL.
它在Jasper Studio中正确生成,但在服务器中它显示为空。
It generates correctly in Jasper Studio, but in the server it shows empty.
请参考附件:
服务器截图
Jasper截图
Server Screenshot Jasper Screenshot
推荐答案
如果你想在没有数据源或空数据源的JasperReport中显示内容,那么你有两个选择:
If you want to show something in the JasperReport without data source or with empty data source then you have two options:
1) 在Jasper Studio中的所有部分无详细信息选项中设置何时无数据类型属性:
1) Set the When No Data Type property on All Section No Detail option in the Jasper Studio:
在JRXML中,可以通过在根< jasperReport> $ c上设置
whenNoDataType =AllSectionsNoDetail
属性来完成$ c>元素。
In JRXML it can be done by setting whenNoDataType="AllSectionsNoDetail"
attribute on the root <jasperReport>
element.
2)或者,当没有数据时,您可以将要显示的内容移动到无数据报告范围:
2) Or you can move content you want to show when there is no data into No Data band of the report:
在JRXML中可以通过添加以下内容来完成:
In JRXML it it can be done by adding of this:
<noData>
<band height="110">
<image>
<reportElement x="0" y="0" width="240" height="110" uuid="d4b9e59b-896e-4881-92a2-c6707c975312"/>
<imageExpression><![CDATA["https://my.image.url/getImage?name=penguin"]]></imageExpression>
</image>
</band>
</noData>
当没有数据时,JasperReport呈现空白页默认情况下,JasperServer显示报告为空,因此请从上面选择一个您希望能够显示所需图像的选项。
JasperReport renders blank page when there are no data as a default and JasperServer shows The report is empty, so select from above options one you prefer to be able to show the image you want.
这篇关于为什么Jasper Reports在服务器中显示空报告,但在jasper studio中正确生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!