我正在尝试使用Jasper iReport Designer 5.6.0生成报告,其中有一个带有表格和一些文本字段的列表。生成的报告应该如下所示:
为此,我使用以下XML文件作为数据源:
<report>
<subreport>
<nameOfState>USA</nameOfState>
<persons>
<person>
<dateOfBirth>1989-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Skyler White</fullName>
<address>Albuquerque 87107</address>
</person>
<person>
<dateOfBirth>1962-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Jesse Pinkman</fullName>
<address>Santa Fé 28</address>
<companies>
<company>
<nameOfCompany>Company 124</nameOfCompany>
<addressOfCompany>Santa Fé 158</addressOfCompany>
</company>
</companies>
</person>
</persons>
</subreport>
<subreport>
<nameOfState>Germany</nameOfState>
<person>
<dateOfBirth>1970-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Hank Schrader</fullName>
<address>El Paso 17</address>
<companies>
<company>
<nameOfCompany>El Paso Company</nameOfCompany>
<addressOfCompany>El Paso 28</addressOfCompany>
</company>
<company>
<nameOfCompany>COMPANY EPC</nameOfCompany>
<addressOfCompany>Santa Fé 18</addressOfCompany>
</company>
</companies>
</person>
</persons>
</subreport>
</report>
和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="report1_subreport1" pageWidth="756" pageHeight="140" whenNoDataType="BlankPage" columnWidth="756" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error" isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">
<property name="ireport.zoom" value="1.7715610000000022"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">
<queryString language="xPath">
<![CDATA[/subreport/persons/person]]>
</queryString>
<field name="dateOfBirth" class="java.lang.String">
<fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>
</field>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">
<queryString language="xPath">
<![CDATA[/company]]>
</queryString>
<field name="nameOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
<field name="addressOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/subreport/persons/person]]>
</queryString>
<field name="nameOfState" class="java.lang.String">
<fieldDescription><![CDATA[nameOfState]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="140" splitType="Stretch">
<componentElement>
<reportElement x="0" y="36" width="753" height="104" uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="104" width="753">
<staticText>
<reportElement mode="Opaque" x="11" y="11" width="100" height="13" backcolor="#C0C0C0" uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Full name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="24" width="100" height="13" backcolor="#C0C0C0" uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address:]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="37" width="100" height="13" backcolor="#C0C0C0" uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Date of birth:]]></text>
</staticText>
<textField>
<reportElement x="112" y="11" width="239" height="13" uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="24" width="239" height="13" uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="37" width="239" height="13" uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement key="NajdenaOsobaTable1" style="table 3" stretchType="RelativeToBandHeight" mode="Transparent" x="96" y="66" width="645" height="25" isPrintWhenDetailOverflows="true" uuid="99480409-009b-4f75-b435-ad99403ddb56"/>
<jr:table whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/person/companies/company")]]></dataSourceExpression>
</datasetRun>
<jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="125" height="17" backcolor="#C0C0C0" uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Name of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="125" height="16" isPrintWhenDetailOverflows="true" uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="17" backcolor="#C0C0C0" uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="160" height="16" isPrintWhenDetailOverflows="true" uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{addressOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
<textField>
<reportElement x="12" y="10" width="100" height="20" uuid="a8753122-9817-4500-81f2-99d703df00b8"/>
<textFieldExpression><![CDATA[$F{nameOfState}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
这就是我得到的结果报告(灰线是分页符):
这是报表检查器在iReport Designer中的外观
所以我只在这个子报表中使用细节栏。
编辑:列表是必需的,因为数据来自多个国家,而此jrxml表示嵌套在主报表中的子报表。
这是关于在子数据源中正确定义子数据集(包含相关字段)和XPath查询的全部内容。一般的指示是向下查询到节点,然后返回一个节点生成子数据源。
这种情况下的解决方案是首先查询细节带(报表的主XPath查询)
<queryString language="XPath">
<![CDATA[/report/subreport]]>
</queryString>
通过这种方式,您可以在“详细信息”栏中访问第一个字段“状态名称”。
然后
在细节栏中,当我们在节点上“运行”子报告时,我们添加了jr:列表组件,子数据源将是子报告/人员/人员,以访问字段dateOfBirth、fullName等。
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
然后我们在节点人,因此对于jr: table
,您的查询是/人/公司/公司
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/companies/company")]]></dataSourceExpression>
</datasetRun>
对于子数据集和字段定义,请参阅完整的示例,它更直接,因为您正在创建数据源(子数据源)。子数据集实际上不需要XPath查询(仅在主查询上需要),您只需要具有与xml标记同名的正确字段声明。
<?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="report1_subreport1" pageWidth="756" pageHeight="140" whenNoDataType="BlankPage" columnWidth="756" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error" isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">
<field name="dateOfBirth" class="java.lang.String">
<fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>
</field>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">
<field name="nameOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[nameOfCompany]]></fieldDescription>
</field>
<field name="addressOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[addressOfCompany]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/report/subreport]]>
</queryString>
<field name="nameOfState" class="java.lang.String">
<property name="net.sf.jasperreports.xpath.field.expression" value="nameOfState"/>
<fieldDescription><![CDATA[nameOfState]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="140" splitType="Stretch">
<componentElement>
<reportElement x="0" y="36" width="753" height="104" uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="104" width="753">
<staticText>
<reportElement mode="Opaque" x="11" y="11" width="100" height="13" backcolor="#C0C0C0" uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Full name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="24" width="100" height="13" backcolor="#C0C0C0" uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address:]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="37" width="100" height="13" backcolor="#C0C0C0" uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Date of birth:]]></text>
</staticText>
<textField>
<reportElement x="112" y="11" width="239" height="13" uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="24" width="239" height="13" uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="37" width="239" height="13" uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement key="NajdenaOsobaTable1" style="table 3" stretchType="RelativeToBandHeight" mode="Transparent" x="96" y="66" width="645" height="25" isPrintWhenDetailOverflows="true" uuid="99480409-009b-4f75-b435-ad99403ddb56"/>
<jr:table whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/companies/company")]]></dataSourceExpression>
</datasetRun>
<jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="125" height="17" backcolor="#C0C0C0" uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Name of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="125" height="16" isPrintWhenDetailOverflows="true" uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="17" backcolor="#C0C0C0" uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="160" height="16" isPrintWhenDetailOverflows="true" uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{addressOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
<textField>
<reportElement x="12" y="10" width="100" height="20" uuid="a8753122-9817-4500-81f2-99d703df00b8"/>
<textFieldExpression><![CDATA[$F{nameOfState}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
我有一个要求,我必须阅读CSV文件并在Jasper中准备一份报告。我能够在常规文本字段中使用CSV数据源。但是当我在详细信息或摘要部分添加一个表时,它需要创建一个新的数据集。我成功地创建了它,但是当报告运行时,它无法从CSV数据源获取数据,我得到了一个空白的报告。如果我使用数据库而不是CSV,同样的事情也会发生。Jasper中有bug吗?
看着您的stackoverflow,我修改了我的主报表和报表的java构建。如何传递XML数据源?我还在收到空白报告。
因为JasperReport可以将JavaBean集合作为数据源。我们可以用一个引用多个SetCollections的单个对象发送一个SetCollection吗。并使用这些引用传递给编译后的jrxml文件,每次传递不同的setCollection时,都使用对JasPerfillManager.FillReport()的多重调用。我只是想知道编译后的jrxml文件是否会用最后一次调用填充,或者是否
你好,在我解释我的问题之前,我会告诉你我想回答什么。 我正在尝试创建一个子报告,显示用户的不同收入。一个用户可以收到多次捐赠,出售了多栋房子/房产,赢得了比赛等。所有这些操作都有更多关于他们收到多少钱、缴纳的税款的详细信息,… 现在,我正在尝试在一个细节中显示用户的详细信息(姓名,姓氏,..;)。这行得通。下一个细节带将用于捐赠。我创建了一个子报表,在其中指定了此部分的布局。但是,此子报表所需的数
问题内容: 如何在Django(Python)中像Google App Engine(Python)中的ListProperty属性一样创建ListField ?我的数据是这样的名单:3,4,5,6,7,8。 我必须定义什么属性,以及如何从中获取值? 问题答案: 使用你可以使用的类型来重新研究它。但这有一些假设,例如你不在列表中存储复杂类型的事实。出于这个原因,我曾经强制只将简单的内置类型作为成员