Отчет с двумя страницами (подотчет) не будет генерировать вторую страницу - PullRequest
0 голосов
/ 20 мая 2019

У меня есть два одностраничных отчета в Jaspersoft Studio, и мне нужно, чтобы второй был подотчетом первого. Второй находится в группе «Сводка» первого в качестве подотчета, однако, когда я генерирую первый отчет, генерируется только одна страница, вторая не отображается. Второй отчет хорошо генерируется при индивидуальной генерации, но как подотчет он не отображается.

Первый имеет 595 x 1200 пикселей (я увеличил его высоту до значения 1200 пикселей, потому что произошла ошибка при попытке создать отчет в размере, который я считаю «идеальным», 595 x 300 пикселей, предположительно потому, что второй отчет не умещался на первой странице.

Второй отчет имеет 842 x 595 пикселей (стандартное изображение формата A4).

PS: Я добавил компонент Break (разрыв страницы) перед вложенным отчетом в сводке, и он начал генерировать две страницы, но этого было недостаточно: второй пустой.

Источники для первого и второго докладов:

CustomerData.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="CustomerData" pageWidth="595" pageHeight="1200" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="bd4d8470-7810-4186-97d6-d71f820d6812">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Customer Info Data Adapter "/>
    <field name="birthday" class="java.time.LocalDate">
        <fieldDescription><![CDATA[birthday]]></fieldDescription>
    </field>
    <field name="observacao" class="java.lang.String">
        <fieldDescription><![CDATA[observacao]]></fieldDescription>
    </field>
    <field name="orderNumber" class="java.lang.Integer">
        <fieldDescription><![CDATA[orderNumber]]></fieldDescription>
    </field>
    <field name="phone" class="java.lang.String">
        <fieldDescription><![CDATA[phone]]></fieldDescription>
    </field>
    <field name="name" class="java.lang.String">
        <fieldDescription><![CDATA[name]]></fieldDescription>
    </field>
    <field name="email" class="java.lang.String">
        <fieldDescription><![CDATA[email]]></fieldDescription>
    </field>
    <columnHeader>
        <band height="30" splitType="Stretch">
            <staticText>
                <reportElement x="483" y="0" width="49" height="30" uuid="1e51bb02-fa8b-48bd-a58d-f16139a04940"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Email]]></text>
            </staticText>
            <staticText>
                <reportElement x="420" y="0" width="60" height="30" uuid="ff6474e7-7410-42bb-bd20-d2d36433a667"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Aniversário]]></text>
            </staticText>
            <staticText>
                <reportElement x="360" y="0" width="60" height="30" uuid="99bf0d76-5e6b-4b1a-b31f-a4a4b772b91a"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Nome]]></text>
            </staticText>
            <staticText>
                <reportElement x="310" y="0" width="50" height="30" uuid="a274c422-f123-42e0-b982-be9fc8cfa1f8"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Número do pedido]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="34" splitType="Stretch">
            <textField>
                <reportElement x="310" y="0" width="50" height="30" uuid="c2580e15-8711-4f3c-a0f8-91352165bdee"/>
                <textFieldExpression><![CDATA[$F{orderNumber}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="360" y="0" width="60" height="30" uuid="ad811b37-da69-4624-9dbf-c0eeb4fd7e8b"/>
                <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="420" y="0" width="60" height="30" uuid="0e2dcac2-0359-474d-807e-a08c135d3758"/>
                <textFieldExpression><![CDATA[$F{birthday}.format( java.time.format.DateTimeFormatter.ofPattern("dd/MM/yyyy") )]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="480" y="0" width="52" height="30" uuid="285f9ede-e240-483c-8709-3596d8e25b14"/>
                <textFieldExpression><![CDATA[$F{email}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <pageFooter>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement x="440" y="0" width="60" height="18" uuid="616ea806-33dd-4e95-9881-7ec4bc81ef99"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Página " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement x="500" y="0" width="53" height="18" uuid="41fdb36f-d901-4335-b402-58d51bd62a5d"/>
                <textFieldExpression><![CDATA[" de " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
    <summary>
        <band height="215" splitType="Stretch">
            <subreport>
                <reportElement x="0" y="10" width="553" height="200" uuid="7cfb9c5c-358e-46e5-9f62-385d1d1c974f"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION} ]]></connectionExpression>
                <subreportExpression><![CDATA["CustomerAddresses.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </summary>
</jasperReport>

CustomerAddresses.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="CustomerAddresses" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c3c27bb5-2480-413f-87af-06a106a9b242">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter "/>
    <field name="number" class="java.lang.String">
        <fieldDescription><![CDATA[number]]></fieldDescription>
    </field>
    <field name="city" class="java.lang.String">
        <fieldDescription><![CDATA[city]]></fieldDescription>
    </field>
    <field name="bairro" class="java.lang.String">
        <fieldDescription><![CDATA[bairro]]></fieldDescription>
    </field>
    <field name="street" class="java.lang.String">
        <fieldDescription><![CDATA[street]]></fieldDescription>
    </field>
    <field name="complement" class="java.lang.String">
        <fieldDescription><![CDATA[complement]]></fieldDescription>
    </field>
    <field name="title" class="java.lang.String">
        <fieldDescription><![CDATA[title]]></fieldDescription>
    </field>
    <field name="cep" class="java.lang.String">
        <fieldDescription><![CDATA[cep]]></fieldDescription>
    </field>
    <field name="referencePoint" class="java.lang.String">
        <fieldDescription><![CDATA[referencePoint]]></fieldDescription>
    </field>
    <columnHeader>
        <band height="62" splitType="Stretch">
            <staticText>
                <reportElement x="20" y="20" width="100" height="30" uuid="e0013f45-d0ed-4c51-9aca-9de907da1d9c"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Título]]></text>
            </staticText>
            <staticText>
                <reportElement x="130" y="20" width="100" height="30" uuid="92a0e07c-b9ee-4c75-a048-689a85bf9457"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Rua]]></text>
            </staticText>
            <staticText>
                <reportElement x="240" y="20" width="100" height="30" uuid="5f1985ff-0847-4e69-abbe-e5df3bf52ccb"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Cidade]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="60" splitType="Stretch">
            <textField>
                <reportElement x="20" y="30" width="100" height="30" uuid="cb4f331a-5dd3-432a-808e-161d3e0cad3d"/>
                <textFieldExpression><![CDATA[$F{title}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="130" y="30" width="100" height="30" uuid="f541ed9a-0974-412b-9991-e36f9d499af8"/>
                <textFieldExpression><![CDATA[$F{street}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="240" y="30" width="100" height="30" uuid="1e81595e-56fc-4e88-8b31-9057cbb92486"/>
                <textFieldExpression><![CDATA[$F{city}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...