我在使用XML 作为数据源的报告摘要面板中创建表格组件时遇到问题,最终报告仅显示一个空白行。
下面是我的名为ProjectXML.xml的 xml 数据源
<testsuites>
<testsuite name="testsuite1"/>
<testsuite name="testsuite2"/>
<testsuite name="testsuite3"/>
</testsuites>
下面是我的.jrxml文件,名为report12.jrxml
<?xml version="1.0" encoding="UTF-8"?>
<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="report12" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="bb749013-793e-4a97-a43a-08d89a11ce20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#3300CC"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#3300CC"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#3300CC"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#3300CC"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#EFF7FF"/>
</conditionalStyle>
</style>
<subDataset name="tableDataSet" uuid="44f57638-9650-43f7-9a45-b12c6144c112">
<queryString language="xPath">
<![CDATA[/testsuites/testsuite]]>
</queryString>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[@name]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/testsuites/testsuite]]>
</queryString>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[@name]]></fieldDescription>
</field>
<summary>
<band height="238" splitType="Stretch">
<componentElement>
<reportElement uuid="59f049a5-d77e-480c-a1ee-46987630290d" key="table" style="table" x="0" y="0" width="555" height="238"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="tableDataSet" uuid="6d3ecced-ba97-49c1-aec9-7f5903748fa5">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column uuid="ed4b1e17-dcec-4ed6-9f1f-efb543f240b7" width="90">
<jr:columnHeader style="table_CH" height="30">
<staticText>
<reportElement uuid="e2772a76-f9da-4438-8aa3-78cee739bdaf" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20">
<textField>
<reportElement uuid="d496fc00-bab8-4b85-bb8d-c75c1cfc3dc4" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
</jasperReport>
下面是report12.jrxml的空白预览截图
高级感谢您为此提供的任何帮助,以获取带有TestSuite名称的完整表格。