サマリーバンドのテーブルコンポーネントを使用してプロジェクトでJasperReportsを使用し、データを提供していますJRBeanCollectionDataSource
が、レポートを抽出した後、レポートのタイトルのみを取得し、テーブルが表示されません。
これが私の.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="CampaignSummary" language="groovy" pageWidth="1400" pageHeight="1000" orientation="Landscape" columnWidth="1360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ef078799-c539-490f-b244-d493f4522ef2">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="163"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#00FFFF"/>
<style name="table_CH" mode="Opaque" backcolor="#BFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#EFFFFF"/>
</conditionalStyle>
</style>
<subDataset name="TableDataset" uuid="c99fd89d-9d8f-488f-95db-360a7f5aba96">
<field name="CampaignID" class="java.lang.String">
<fieldDescription><![CDATA[me.CampaignID]]></fieldDescription>
</field>
<field name="CampaignName" class="java.lang.String">
<fieldDescription><![CDATA[Campaign Name]]></fieldDescription>
</field>
.
.
.
......some more fields....
.
.
<field name="NetImpact" class="java.lang.String">
<fieldDescription><![CDATA[Net Impact]]></fieldDescription>
</field>
</subDataset>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="54" splitType="Stretch">
<staticText>
<reportElement uuid="8b41287b-3930-416a-ba00-7f4a9c907e26" x="0" y="0" width="1360" height="54"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial Rounded MT Bold" size="24"/>
</textElement>
<text><![CDATA[Campaign Summary Report]]></text>
</staticText>
</band>
</title>
<summary>
<band height="239" splitType="Stretch">
<frame>
<reportElement uuid="61313d06-6df1-4212-ab8f-8e311dc5ad33" x="0" y="0" width="1360" height="87"/>
</frame>
<frame>
<reportElement uuid="c04b08f6-89d3-4104-87ba-adecd3c4f7dd" x="0" y="87" width="1360" height="152"/>
<componentElement>
<reportElement uuid="8afc21c1-7b57-4dab-8178-8810c1183dd9" key="table" style="table" x="0" y="0" width="1360" height="152"/>
<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">
<dataSourceExpression>
<![CDATA[($P{REPORT_DATA_SOURCE})]]>
</dataSourceExpression>
</datasetRun>
<jr:column width="90" uuid="eece2ecf-027d-4ef1-bd05-8d7d6bbbc0b0">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement uuid="c0d108a0-9f4b-4ec3-b9d0-664ea0724584" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[Campaign Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement uuid="6a8f7bf6-5e9b-4f77-a524-9a8d7f0ee2ca" x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[String.valueOf($F{CampaignName})]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
.
.
.some more columns...
.
<jr:column width="80" uuid="312f9143-cee8-46fb-a296-27172c4fca98">
<jr:columnHeader style="table_CH" height="30" rowSpan="1">
<staticText>
<reportElement uuid="22ec2935-d4a9-4b64-856d-e64d72f0d856" x="0" y="0" width="80" height="30"/>
<textElement/>
<text><![CDATA[Net Impact]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement uuid="071cddad-63f1-47bc-8da5-a2d6752e3abe" x="0" y="0" width="80" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[String.valueOf($F{NetImpact})]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</frame>
</band>
</summary>
そしてJavaコードは
CampaignSummaryBeanFactory campaignSummaryBeanFactory =new CampaignSummaryBeanFactory();
JasperFillManager.fillReportToFile("build/reports/CampaignSummary.jasper", null, new JRBeanCollectionDataSource(campaignSummaryBeanFactory.getCampaignSummaryBeans()));