Как вставить pageBreak в JasperSoft Studio? - PullRequest
0 голосов
/ 15 октября 2019

У нас есть более 70 тыс. Записей для выборки и отображения, и мы хотели ограничить 1000 записей на каждую страницу. Итак, как мы можем достичь этого. Поскольку я видел ссылки на тот же запрос, но для iReport, который не работал для меня в студии Jaspersoft.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3  -->
<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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d8556b71-e51d-4eec-935b-96c797fd7bed">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter "/>
    <queryString language="SQL">
        <![CDATA[select device_id, network_id, subscriber_id from device where ROWNUM <3000]]>
    </queryString>
    <field name="DEVICE_ID" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.label" value="DEVICE_ID"/>
    </field>
    <field name="NETWORK_ID" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.label" value="NETWORK_ID"/>
    </field>
    <field name="SUBSCRIBER_ID" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.label" value="SUBSCRIBER_ID"/>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="550" height="79" backcolor="#006699" uuid="52ee0bd6-b37b-4ab4-aabc-6cd9fe87a81f"/>
                <textElement>
                    <font fontName="Times New Roman" size="20" isBold="true"/>
                </textElement>
                <text><![CDATA[DeviceBootstrapReport]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band height="41" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="62" splitType="Stretch">
            <line>
                <reportElement x="0" y="2" width="550" height="1" uuid="95df1c7e-89b7-4a0d-b763-8ac55df6c551"/>
            </line>
            <staticText>
                <reportElement x="0" y="15" width="80" height="30" backcolor="#006699" uuid="907105e4-b890-4073-b564-26487e8f1a65"/>
                <box>
                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Device ID]]></text>
            </staticText>
            <staticText>
                <reportElement x="120" y="15" width="100" height="30" uuid="db1a6c14-3f1b-4c75-8d41-129118c63e26"/>
                <box>
                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Subscriber ID]]></text>
            </staticText>
            <staticText>
                <reportElement x="280" y="15" width="100" height="30" backcolor="#006699" uuid="55331e3b-680e-44c1-a588-989c04a797cb"/>
                <box>
                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Network ID]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="125" splitType="Stretch">
            <line>
                <reportElement x="1" y="0" width="550" height="1" uuid="e0e0d679-2a49-42fb-a352-53310de4a82c"/>
            </line>
            <textField>
                <reportElement x="1" y="20" width="80" height="60" uuid="59926580-4c76-4382-9cb2-125982cdc425"/>
                <textFieldExpression><![CDATA[$F{DEVICE_ID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="110" y="20" width="110" height="60" uuid="6c888b26-0db9-4a77-ae7d-9b8c1c50b8ef"/>
                <textFieldExpression><![CDATA[$F{SUBSCRIBER_ID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="280" y="20" width="110" height="60" uuid="86cff57c-7976-468d-aeed-83bec544e6b0"/>
                <textFieldExpression><![CDATA[$F{NETWORK_ID}]]></textFieldExpression>
            </textField>
            <break>
                <reportElement x="0" y="13" width="550" height="1" uuid="4698ba53-5a4e-489b-b7ba-f037bff836fe">
                    <printWhenExpression><![CDATA[$V{PAGE_COUNT}==1000]]></printWhenExpression>
                </reportElement>
            </break>
        </band>
    </detail>
    <columnFooter>
        <band height="48" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="551" height="48" forecolor="#B0A9A9" backcolor="#8A8484" uuid="37c0fea7-d0cd-47f5-a884-a563ab7a0560"/>
            </textField>
        </band>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

Пожалуйста, обратитесь к коду, где я пытаюсь использовать Break из палитры впрервать поток, когда количество страниц достигнет 1000.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...