Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jasper reports 为什么第二页上的细节栏会增加?_Jasper Reports - Fatal编程技术网

Jasper reports 为什么第二页上的细节栏会增加?

Jasper reports 为什么第二页上的细节栏会增加?,jasper-reports,Jasper Reports,我正在为发票定义一个报告,一张发票的详细信息中可能有n个项目(行)。我定义了一个数据集,以便在不需要子报表的情况下显示项目。以下是我的详细资料: <detail> <band height="275" splitType="Stretch"> <rectangle> <reportElement x="0" y="0" width="60" height="16" uuid="590f4cac-fba0-4

我正在为发票定义一个报告,一张发票的详细信息中可能有n个项目(行)。我定义了一个数据集,以便在不需要子报表的情况下显示项目。以下是我的详细资料:

<detail>
    <band height="275" splitType="Stretch">
        <rectangle>
            <reportElement x="0" y="0" width="60" height="16" uuid="590f4cac-fba0-4e0b-aa74-db059a817946"/>
        </rectangle>
        <rectangle>
            <reportElement x="60" y="0" width="140" height="16" uuid="1cc31301-e884-4648-952d-a68bcaa12b23"/>
        </rectangle>
        <rectangle>
            <reportElement x="200" y="0" width="31" height="16" uuid="ac690ad3-a913-454f-80d0-574505609db1"/>
        </rectangle>
        <rectangle>
            <reportElement x="231" y="0" width="100" height="16" uuid="6d623fd0-df6f-4ffd-b92b-8f18e0d2d5b2"/>
        </rectangle>
        <rectangle>
            <reportElement x="331" y="0" width="37" height="16" uuid="afef801a-3280-4810-8d85-c1f591d2b75b"/>
        </rectangle>
        <staticText>
            <reportElement x="3" y="2" width="44" height="11" uuid="f525bb2b-106a-44a3-9fb0-817f1eeb8260"/>
            <textElement>
                <font size="6"/>
            </textElement>
            <text><![CDATA[Artikel]]></text>
        </staticText>
        <staticText>
            <reportElement x="63" y="2" width="126" height="11" uuid="0f97aa9e-cb83-4a95-92fc-fdc01e1506f1"/>
            <textElement>
                <font size="6"/>
            </textElement>
            <text><![CDATA[Beschreibung]]></text>
        </staticText>
        <staticText>
            <reportElement x="207" y="2" width="22" height="11" uuid="6234d14c-abe2-482e-b6bb-f1c65dc19005"/>
            <textElement textAlignment="Right">
                <font size="6"/>
            </textElement>
            <text><![CDATA[Menge]]></text>
        </staticText>
        <staticText>
            <reportElement x="237" y="2" width="92" height="11" uuid="2bd9712e-b8be-4b90-823d-a530f6c7dcba"/>
            <textElement textAlignment="Right">
                <font size="6"/>
            </textElement>
            <text><![CDATA[Einheitspreis]]></text>
        </staticText>
        <staticText>
            <reportElement x="340" y="2" width="25" height="11" uuid="dbf02042-62f2-4b70-9b8b-fae588cb8055"/>
            <textElement textAlignment="Right">
                <font size="6"/>
            </textElement>
            <text><![CDATA[Rabatt]]></text>
        </staticText>
        <rectangle>
            <reportElement x="368" y="0" width="70" height="16" uuid="54f1f443-d742-4287-8ae6-d06b04682bf4"/>
        </rectangle>
        <rectangle>
            <reportElement x="437" y="0" width="34" height="16" uuid="f23aa7d5-3eb9-478a-a799-a8acfe96d7af"/>
        </rectangle>
        <rectangle>
            <reportElement x="471" y="0" width="84" height="16" uuid="7b4a3a55-b161-44c7-8512-33a127d68ba3"/>
        </rectangle>
        <staticText>
            <reportElement x="381" y="2" width="54" height="11" uuid="e12d9869-3dcd-4b81-89f8-b3a3c6b2e28c"/>
            <textElement textAlignment="Right">
                <font size="6"/>
            </textElement>
            <text><![CDATA[MwSt. Grundlage]]></text>
        </staticText>
        <staticText>
            <reportElement x="441" y="2" width="28" height="11" uuid="fb7f8a0e-1632-454f-9742-5179831c8dc4"/>
            <textElement textAlignment="Right">
                <font size="6"/>
            </textElement>
            <text><![CDATA[MwSt.]]></text>
        </staticText>
        <staticText>
            <reportElement x="505" y="2" width="47" height="11" uuid="da9a079f-dc7e-4fef-9f31-eabd65340967"/>
            <textElement textAlignment="Right">
                <font size="6"/>
            </textElement>
            <text><![CDATA[MwSt. Betrag]]></text>
        </staticText>
        <rectangle>
            <reportElement x="0" y="16" width="60" height="248" uuid="cd7f5e9a-aeae-425c-8783-22084707b432"/>
        </rectangle>
        <rectangle>
            <reportElement x="60" y="16" width="140" height="248" uuid="01ee9155-aed8-4a55-8160-5f73ac6b1085"/>
        </rectangle>
        <rectangle>
            <reportElement x="200" y="16" width="31" height="248" uuid="66698906-69ee-4fdc-8a04-ce14372bd065"/>
        </rectangle>
        <rectangle>
            <reportElement x="231" y="16" width="100" height="248" uuid="0c260fbe-b300-4962-ad7b-ff7666fa2baa"/>
        </rectangle>
        <rectangle>
            <reportElement x="331" y="16" width="37" height="248" uuid="1902828b-f84c-440c-8e3f-24cdffea33ec"/>
        </rectangle>
        <rectangle>
            <reportElement x="368" y="16" width="69" height="248" uuid="880c1b82-4316-493a-b5b3-c4342bbb74c9"/>
        </rectangle>
        <rectangle>
            <reportElement x="437" y="16" width="34" height="248" uuid="ee1c4e69-b69e-4cc8-9b83-24e9867012de"/>
        </rectangle>
        <rectangle>
            <reportElement x="471" y="16" width="84" height="248" uuid="eade602d-0afa-4a6e-a3aa-5de350dc2ee5"/>
        </rectangle>
        <componentElement>
            <reportElement x="0" y="16" width="555" height="17" uuid="be7e1e99-0990-4f3d-beaf-b304c08be036"/>
            <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="items" uuid="ab906203-20bb-4347-806b-ef000f212bf9">
                    <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{righeDocumento})]]></dataSourceExpression>
                </datasetRun>
                <jr:listContents height="17" width="555">
                    <textField>
                        <reportElement x="3" y="2" width="56" height="14" uuid="448ef958-9459-4ab1-8896-f5b65dd7a552"/>
                        <textFieldExpression><![CDATA[$F{articolo}]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="63" y="2" width="136" height="14" uuid="24634427-d38f-4679-8996-a96d5051774b"/>
                        <textFieldExpression><![CDATA[$F{descrizione}]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="236" y="2" width="92" height="14" uuid="20bda0b8-a3c0-47e7-bdff-555c481a894d"/>
                        <textElement textAlignment="Right"/>
                        <textFieldExpression><![CDATA[new DecimalFormat("0.00 €").format($F{prezzo})]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="207" y="2" width="21" height="14" uuid="61766ba4-57d0-4509-ac41-ffd7bb4e12ef"/>
                        <textElement textAlignment="Right"/>
                        <textFieldExpression><![CDATA[$F{quantita}]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="338" y="2" width="27" height="14" uuid="535705c6-d0b6-401d-b767-efafb3ba42f7"/>
                        <textElement textAlignment="Right"/>
                        <textFieldExpression><![CDATA[$F{sconto} == null ? "" : $F{sconto}+" %"]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="439" y="2" width="28" height="14" uuid="0dc5fa14-efac-4c5b-898a-9a9152e588f7"/>
                        <textElement textAlignment="Right"/>
                        <textFieldExpression><![CDATA[$F{aliquota}]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="375" y="2" width="59" height="14" uuid="2772b49b-5355-463d-bebf-856537a416a3"/>
                        <textElement textAlignment="Right"/>
                        <textFieldExpression><![CDATA[new DecimalFormat("0.00 €").format($F{costo})]]></textFieldExpression>
                    </textField>
                    <textField>
                        <reportElement x="482" y="2" width="70" height="14" uuid="0259a153-a0c2-4589-b296-fdca4ceeed2b"/>
                        <textElement textAlignment="Right"/>
                        <textFieldExpression><![CDATA[new DecimalFormat("0.00 €").format($F{iva})]]></textFieldExpression>
                    </textField>
                </jr:listContents>
            </jr:list>
        </componentElement>
    </band>
</detail>

结果如下图所示:

具有多行的示例:

具有两行的示例:

问题是,当我有更多的行时,它包含第二页(在我的问题中没有显示)和页眉和页脚,细节是空的。其余的我们可以从图片上看到,是好的。
为什么?如何修复它?

您选择了一种奇怪的方法来创建此报告,通常的方法是使明细栏代表发票中的1条商品行(因此明细栏的高度为14)

然后,如果需要在页面底部划线,则始终可以使用背景带

现在发生了什么?可能列表溢出在您的详细信息栏中,下面也有空白,它无法在同一页上创建另一个列表并将空间移动到下一页

解决方案
使用jasper报告的常规方式,数据源包含您的行、列标题栏中的标题栏、详细栏中的字段(高度14)以及您的垂直行 背景带,也导出为excel等将更干净。

如果要保留列表,请将所有矩形移动到 背景条带,并将细节条带的高度降低到剩余高度 组件(标题+列表高度)


您选择了一种奇怪的方法来创建此报告,通常的方法是使明细栏代表发票中的1条商品行(因此明细栏的高度为14)

然后,如果需要在页面底部划线,则始终可以使用背景带

现在发生了什么?可能列表溢出在您的详细信息栏中,下面也有空白,它无法在同一页上创建另一个列表并将空间移动到下一页

解决方案
使用jasper报告的常规方式,数据源包含您的行、列标题栏中的标题栏、详细栏中的字段(高度14)以及您的垂直行 背景带,也导出为excel等将更干净。

如果要保留列表,请将所有矩形移动到 背景条带,并将细节条带的高度降低到剩余高度 组件(标题+列表高度)


您的报告具有奇怪的格式:1)您将列标题放置到详细信息栏(您可以使用列标题,也可以使用表组件而不是列表);2) 不使用框来绘制边框;3) 最好将列表组件放置到标题栏(而不是详细信息);4) 您使用的矩形太高了,您的报告格式很奇怪:1)您将列标题放置到了详细信息栏(您可以使用列标题,也可以使用表组件而不是列表);2) 不使用框来绘制边框;3) 最好将列表组件放置到标题栏(而不是详细信息);4) 你用的矩形太高了