我使用Jasper Report studio使用书籍模板设计报告,我确信单个报告是可以的,但当我预览合并的报告时,我发现返回了一个空文档,显示"文档为空";,以下是主页面的代码。请帮帮我!
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.19.1.final using JasperReports Library version 6.19.1-867c00bf88cd4d784d404379d6c05e1b419e8a4c -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="healthdoc" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" sectionType="Part" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" whenResourceMissingType="Empty" uuid="d2716064-8ae4-40cf-a575-33afba400e3a">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="business"/>
<property name="net.sf.jasperreports.print.create.bookmarks" value="true"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.book.group.cover.header" value="Cover and Contents"/>
<property name="com.jaspersoft.studio.book.group.cover.footer" value="Backcover"/>
<property name="ireport.jasperserver.url" value="http://10.0.1.33:8188/jasperserver/"/>
<property name="ireport.jasperserver.user" value="jasperadmin"/>
<property name="ireport.jasperserver.report.resource" value="/reports/hms/hms_doc_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/reports/hms/hms_doc"/>
<style name="Title" forecolor="#FFFFFF" fontName="stsong" fontSize="50" isBold="false" pdfFontName="stsong"/>
<style name="SubTitle" forecolor="#CCCCCC" fontName="stsong" fontSize="18" isBold="false" pdfFontName="stsong"/>
<style name="Column header" forecolor="#666666" fontName="stsong" fontSize="14" isBold="true" pdfFontName="stsong"/>
<style name="Detail" mode="Transparent" fontName="stsong" pdfFontName="stsong"/>
<parameter name="id" class="java.lang.Integer">
<defaultValueExpression><![CDATA[1317]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[select 1 FROM mem_guest t]]>
</queryString>
<group name="cover">
<groupHeader>
<part uuid="48cb43f5-1d78-4a4e-94c7-bc80581e2049">
<property name="net.sf.jasperreports.bookmarks.data.source.parameter" value="REPORT_DATA_SOURCE"/>
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportParameter name="guestId">
<subreportParameterExpression><![CDATA[$P{id}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA["cover.jasper"]]></subreportExpression>
</p:subreportPart>
</part>
<part evaluationTime="Report" uuid="bf47c82d-6bc2-422e-97e2-dfa09e013bdb">
<property name="net.sf.jasperreports.bookmarks.data.source.parameter" value="REPORT_DATA_SOURCE"/>
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportParameter name="guestId">
<subreportParameterExpression><![CDATA[$P{id}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA["content.jasper"]]></subreportExpression>
</p:subreportPart>
</part>
</groupHeader>
</group>
</jasperReport>
尝试将连接参数传递给部件:
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportParameter name="REPORT_CONNECTION">
<subreportParameterExpression><![CDATA[$P{REPORT_CONNECTION}]]></subreportParameterExpression>
</subreportParameter>
...
此外,从显示数据源中数据的部件中删除net.sf.jasperreports.bookmarks.data.source.parameter
属性,该属性应仅为"目录"部件设置。