问题:我有一个两列的子报告,里面有很多数据。
我有一个两列的子报告,里面有很多数据。 当它出现在我的主报表的第一页时,它将数据均匀地分成两列。 然而,当它溢出到第二页时,它将这两列数据渲染成一列,其长度相当于第二页的长度,并将我的报告的所有其他部分推到第三页。
期待。
在第二页,把子报告分成两半,并渲染成两列。
母报告 - ThiraPresubmissionThreat.jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 7.3.1.final using JasperReports Library version 6.8.1-3d4b87119c827be13776e451fb3738062f84a87d -->
<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="ThiraPresubmissionThreat" pageWidth="612" pageHeight="792" columnWidth="468" leftMargin="72" rightMargin="72" topMargin="36" bottomMargin="36" uuid="da08ff4d-c3ae-4475-bf66-622c167cd036">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="XXXXXXXXXXXXXXXXXXXXXXX"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<parameter name="domainId" class="java.lang.Long"/>
<parameter name="domainName" class="java.lang.String"/>
<parameter name="assessmentYear" class="java.lang.Integer"/>
<queryString language="SQL">
<![CDATA[XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]]>
</queryString>
<field name="thira_threat_id" class="java.lang.Long">
<property name="com.jaspersoft.studio.field.label" value="thira_threat_id"/>
<property name="com.jaspersoft.studio.field.tree.path" value="thira_threat"/>
</field>
<field name="thira_threat_name" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="thira_threat_name"/>
<property name="com.jaspersoft.studio.field.tree.path" value="thira_threat"/>
</field>
<field name="category_name" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="category_name"/>
<property name="com.jaspersoft.studio.field.tree.path" value="list_item"/>
</field>
<field name="type_name" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="type_name"/>
<property name="com.jaspersoft.studio.field.tree.path" value="list_item"/>
</field>
<field name="terrorism" class="java.lang.Boolean">
<property name="com.jaspersoft.studio.field.label" value="terrorism"/>
<property name="com.jaspersoft.studio.field.tree.path" value="thira_threat"/>
</field>
<field name="description" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="description"/>
<property name="com.jaspersoft.studio.field.tree.path" value="thira_threat"/>
</field>
<field name="source_use_other" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="source_use_other"/>
<property name="com.jaspersoft.studio.field.tree.path" value="thira_threat"/>
</field>
<field name="standardized_impact_count" class="java.lang.Long">
<property name="com.jaspersoft.studio.field.label" value="standardized_impact_count"/>
</field>
<variable name="showedHeader" class="java.lang.Boolean"/>
<group name="ThiraThreatGroup" isStartNewPage="true">
<groupExpression><![CDATA[$F{thira_threat_id}]]></groupExpression>
<groupHeader>
<band height="26">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} < 1]]></printWhenExpression>
<staticText>
<reportElement x="0" y="0" width="468" height="26" forecolor="#003366" uuid="4b9bdcca-bf39-4c91-a90a-8277f39b4f6f"/>
<textElement>
<font size="18" isBold="true"/>
</textElement>
<text><![CDATA[THIRA Step 1 and 2: Threats, Hazards, and Context]]></text>
</staticText>
</band>
<band height="26">
<textField>
<reportElement x="0" y="0" width="468" height="26" forecolor="#006699" uuid="9e2e21b1-28a1-4090-bb48-7e9bf9978b2b"/>
<textElement>
<font size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Threat/Hazard: " + $F{thira_threat_name}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<pageHeader>
<band height="36" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement x="140" y="0" width="327" height="21" uuid="f432ca22-5aec-4bc8-b18a-913153f96107"/>
<textElement textAlignment="Right">
<font size="9"/>
</textElement>
<text><![CDATA[THIRA Steps 1 and 2: Threats, Hazards, and Context]]></text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="24">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<textField>
<reportElement x="0" y="0" width="156" height="24" uuid="79939e1e-d35d-42c2-a562-379065f3e61b"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineStyle="Dashed"/>
</box>
<textElement verticalAlignment="Middle" markup="html"/>
<textFieldExpression><![CDATA["<b>Category:</b> " + $F{category_name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="156" y="0" width="156" height="24" uuid="3039ff87-96a1-4833-b79a-f95ba2732852"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineStyle="Dashed"/>
</box>
<textElement verticalAlignment="Middle" markup="html"/>
<textFieldExpression><![CDATA["<b>Type:</b> " + $F{type_name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="312" y="0" width="156" height="24" uuid="f11dbd41-52a3-493e-9b22-4e66f5cc6432"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineStyle="Dashed"/>
</box>
<textElement verticalAlignment="Middle" markup="html"/>
<textFieldExpression><![CDATA["<b>Terrorism:</b> " + (Boolean.TRUE.equals($F{terrorism}) ? "Yes" : "No")]]></textFieldExpression>
</textField>
</band>
<band height="48">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="23" width="468" height="17" uuid="2014321f-051a-4929-82dc-a082967d4399"/>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="4" width="160" height="18" uuid="847a9bfc-bf40-468b-9b9b-1379d21ef518"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Context Description:]]></text>
</staticText>
</band>
<band height="51" splitType="Immediate">
<subreport overflowType="Stretch">
<reportElement x="0" y="0" width="468" height="40" uuid="24a00653-b03e-40a8-91f5-25e823c4cdcb"/>
<subreportParameter name="thiraThreatId">
<subreportParameterExpression><![CDATA[$F{thira_threat_id}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="rowCount">
<subreportParameterExpression><![CDATA[$F{standardized_impact_count}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["ThiraPresubmissionThreatStandardizedImpact.jasper"]]></subreportExpression>
</subreport>
</band>
<band height="49" splitType="Immediate">
<subreport overflowType="Stretch">
<reportElement x="0" y="0" width="468" height="40" uuid="24a00653-b03e-40a8-91f5-25e823c4cdcb"/>
<subreportParameter name="thiraThreatId">
<subreportParameterExpression><![CDATA[$F{thira_threat_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["ThiraPresubmissionThreatNonStandardizedImpact.jasper"]]></subreportExpression>
</subreport>
</band>
<band height="100">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<rectangle>
<reportElement stretchType="ContainerBottom" x="0" y="50" width="234" height="39" uuid="d95d9f54-9012-4490-ad26-f4c3005cc3ae">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement mode="Opaque" x="0" y="20" width="234" height="30" forecolor="#FFFFFF" backcolor="#003366" uuid="b25a4865-dd52-4ef1-9b0a-2abcbe8c8ad6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d52ebdc1-3ca9-49b3-a716-1714c5b60ef8"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Source Name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="234" y="20" width="234" height="30" forecolor="#FFFFFF" backcolor="#003366" uuid="c97e4632-24a5-4b60-b1ca-fc002ec4537b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="152033f6-eaab-4499-ab58-c3548c2cfd7e"/>
</reportElement>
<box>
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Sources Used to Develop Context Description and Calculate Impacts (Optional)]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="ContainerBottom" x="234" y="50" width="234" height="39" uuid="5aaf0b2f-5803-4e6c-aed7-f2b6e54d7188">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="152033f6-eaab-4499-ab58-c3548c2cfd7e"/>
<property name="com.jaspersoft.layout.grid.x" value="-1"/>
<property name="com.jaspersoft.layout.grid.y" value="1"/>
<property name="com.jaspersoft.layout.grid.weight.x" value="1.0"/>
<property name="com.jaspersoft.layout.grid.weight.y" value="1.0"/>
<property name="com.jaspersoft.layout.grid.rowspan" value="1"/>
<property name="com.jaspersoft.layout.grid.colspan" value="1"/>
<property name="com.jaspersoft.layout.grid.weight.fixed" value="false"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box topPadding="2" leftPadding="5" bottomPadding="2" rightPadding="5">
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{source_use_other}]]></textFieldExpression>
<patternExpression><![CDATA["#,###"]]></patternExpression>
</textField>
<subreport>
<reportElement stretchType="ContainerBottom" x="0" y="50" width="234" height="39" uuid="b71f36e7-afbe-4555-82ef-fbc88b434bf2">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreportParameter name="thiraThreatId">
<subreportParameterExpression><![CDATA[$F{thira_threat_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["ThiraPresubmissionThreatSource.jasper"]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="0" y="0" width="240" height="20" uuid="8db3f369-d844-4d5f-bb9c-3fdc932e62ec"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Source Identification]]></text>
</staticText>
</band>
</detail>
<pageFooter>
<band height="36" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement x="0" y="0" width="468" height="20" uuid="c87e3768-a59f-4b8a-8afb-0e3500f9a5a7"/>
<textElement textAlignment="Center">
<font size="9" isBold="true"/>
</textElement>
<text><![CDATA[FOR OFFICIAL USE ONLY]]></text>
</staticText>
<textField evaluationTime="Master">
<reportElement x="0" y="20" width="468" height="16" uuid="88a6b8f6-e1cc-4323-998a-5947ef7edb96"/>
<textElement textAlignment="Right">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$P{assessmentYear} + " " + $P{domainName} + " THIRA | Page " + $V{MASTER_CURRENT_PAGE} + " of " + $V{MASTER_TOTAL_PAGES}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
子报告 - ThiraPresubmissionThreatStandardizedImpact.jrxml。
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 7.3.1.final using JasperReports Library version 6.8.1-3d4b87119c827be13776e451fb3738062f84a87d -->
<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="ThiraPresubmissionThreatStandardizedImpact" columnCount="2" pageWidth="468" pageHeight="400" columnWidth="234" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="02534ce9-84f1-475b-b3e5-50b7a6169869">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="XXXXXXXXXXXXXXXXXXXXX"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<parameter name="thiraThreatId" class="java.lang.Long"/>
<parameter name="rowCount" class="java.lang.Long"/>
<queryString>
<![CDATA[XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]]>
</queryString>
<field name="impact_category" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="impact_category"/>
</field>
<field name="impact_number" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.label" value="impact_number"/>
<property name="com.jaspersoft.studio.field.tree.path" value="thira_threat_standardized_impact"/>
</field>
<pageHeader>
<band height="20">
<staticText>
<reportElement x="0" y="0" width="176" height="20" uuid="961a7a93-002d-4c26-b471-851ef564fa1b"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Standardized Impact Estimates]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="20" forecolor="#FFFFFF" backcolor="#003366" uuid="86d37fcc-f35c-4b6b-8687-4eda91520bc6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d52ebdc1-3ca9-49b3-a716-1714c5b60ef8"/>
</reportElement>
<box>
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Impact Category]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="160" y="0" width="74" height="20" forecolor="#FFFFFF" backcolor="#003366" uuid="0991a29e-5133-4200-b469-6b13ef47e47c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="152033f6-eaab-4499-ab58-c3548c2cfd7e"/>
</reportElement>
<box>
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Estimate]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Prevent">
<textField isStretchWithOverflow="true">
<reportElement stretchType="ContainerBottom" x="0" y="0" width="160" height="20" uuid="4c95062b-8d6c-42ad-8f78-d7f6d98495a6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d52ebdc1-3ca9-49b3-a716-1714c5b60ef8"/>
</reportElement>
<box topPadding="2" leftPadding="5" bottomPadding="2" rightPadding="5">
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{impact_category}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="ContainerBottom" x="160" y="0" width="74" height="20" uuid="8aad177b-e4c4-4c49-b4c5-379612844506">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="152033f6-eaab-4499-ab58-c3548c2cfd7e"/>
</reportElement>
<box topPadding="2" leftPadding="5" bottomPadding="2" rightPadding="5">
<pen lineWidth="0.25" lineColor="#BFBFBF"/>
<topPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<leftPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<bottomPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
<rightPen lineWidth="0.25" lineStyle="Solid" lineColor="#BFBFBF"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{impact_number}]]></textFieldExpression>
<patternExpression><![CDATA["#,###"]]></patternExpression>
</textField>
</band>
</detail>
</jasperReport>
尝试用下面的解决方案。
将子报告(ThiraPresubmissionThreatStandardizedImpact)的打印顺序属性设置为水平,如下所示。
属性(选项卡)>;高级(选项卡)>;页面列>;打印顺序。
ThiraPresubmissionThreatStandardizedImpact.jrxml。
<jasperReport ...... name="ThiraPresubmissionThreatStandardizedImpact" printOrder="Horizontal" .....>
.......
</jasperReport>
上述配置下的输出(预期输出)
电流输出