【问题标题】:How to display column boundaries at break due to content?如何因内容而中断显示列边界?
【发布时间】:2020-03-12 02:24:18
【问题描述】:

如何显示因内容而中断的列边界?

  1. 所有内容都转移到第二页,但我想保留在第一页。
  2. 在第三页(中断后)的列不显示边框

案例一:

案例 2:

我读过: How to avoid of missing cell's border when a record is separated between 2 pages? 但它没有用。

TIBCO Jaspersoft® Studio 6.8.0 - JasperReports 6.8.0 的可视化设计器。

<?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="TableReport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" isFloatColumnFooter="true" uuid="c927e671-66f3-40f2-a189-49d30d607fe5">
    <property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
    <property name="net.sf.jasperreports.export.pdf.tag.language" value="EN-US"/>
    <property name="net.sf.jasperreports.export.pdf.metadata.title" value="Tabular Report"/>
    <property name="net.sf.jasperreports.export.pdf.display.metadata.title" value="true"/>
    <style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
    <style name="Table">
        <box>
            <pen lineWidth="1.0" lineColor="#FF0000"/>
        </box>
    </style>
    <style name="TableHeader" mode="Opaque" backcolor="#808080"/>
    <style name="TableFooter" mode="Opaque" backcolor="#C0C0C0"/>
    <subDataset name="TableData" uuid="c97671fc-0b4b-478a-828d-ced52c9cb393">
        <variable name="Column1" class="java.lang.String">
            <variableExpression><![CDATA["multi\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline textmulti\nline text"]]></variableExpression>
        </variable>
        <variable name="Column2" class="java.lang.String">
            <variableExpression><![CDATA["text two"]]></variableExpression>
        </variable>
        <variable name="Column3" class="java.lang.String">
            <variableExpression><![CDATA["text three"]]></variableExpression>
        </variable>
        <variable name="Column4" class="java.lang.String">
            <variableExpression><![CDATA["text four"]]></variableExpression>
        </variable>
        <variable name="Column5" class="java.lang.String">
            <variableExpression><![CDATA["12345"]]></variableExpression>
        </variable>
    </subDataset>
    <parameter name="TableDataSource" class="net.sf.jasperreports.engine.JRDataSource"/>
    <title>
        <band height="150" splitType="Stretch">
            <staticText>
                <reportElement x="180" y="5" width="375" height="40" uuid="ce2a6b5f-8284-4bd5-82ad-8e8515d2afb6">
                    <property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
                </reportElement>
                <textElement textAlignment="Right">
                    <font size="22"/>
                </textElement>
                <text><![CDATA[Table Report]]></text>
            </staticText>
            <componentElement>
                <reportElement style="Table" x="0" y="50" width="555" height="100" uuid="c475c968-5a05-4331-8147-5fc24a48070b">
                    <property name="com.jaspersoft.studio.components.autoresize.proportional" value="true"/>
                    <property name="com.jaspersoft.studio.components.autoresize.next" value="true"/>
                </reportElement>
                <c:table xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <datasetRun subDataset="TableData" uuid="2e963060-c6d1-4d40-bf9e-08c82c085560">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
                    </datasetRun>
                    <c:column width="100" uuid="ceaf6eb4-f1e9-4aa8-aca6-3e53b67c1615">
                        <c:columnHeader style="TableHeader" height="30" rowSpan="2">
                            <box leftPadding="10">
                                <pen lineColor="#000000"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="30" uuid="2866e22e-bec7-41a4-98fd-55ad697b0a2e"/>
                                <textElement verticalAlignment="Middle">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Header 1]]></text>
                            </staticText>
                        </c:columnHeader>
                        <c:columnFooter style="TableFooter" height="15">
                            <box leftPadding="10">
                                <pen lineColor="#000000"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="15" uuid="54493ad7-b6d2-4f58-94a5-7428d5cfef7b"/>
                                <textElement verticalAlignment="Middle">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Total 1]]></text>
                            </staticText>
                        </c:columnFooter>
                        <c:detailCell height="15">
                            <box leftPadding="10">
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="15" isPrintWhenDetailOverflows="true" uuid="3cb2a7df-0412-4b7b-b72a-dd6ccf066815"/>
                                <text><![CDATA[]]></text>
                            </staticText>
                            <textField isStretchWithOverflow="true">
                                <reportElement x="0" y="0" width="90" height="15" uuid="c6a3b183-a488-4535-9187-6c4250a443b6"/>
                                <textFieldExpression><![CDATA[$V{Column1}]]></textFieldExpression>
                            </textField>
                        </c:detailCell>
                    </c:column>
                    <c:column width="100" uuid="d1059c8a-83e2-46b7-bd4a-4920e4661363">
                        <c:columnHeader style="TableHeader" height="30" rowSpan="2">
                            <box leftPadding="10">
                                <pen lineColor="#000000"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="30" uuid="10955f42-4b3b-4c06-b277-bc06c8af4529"/>
                                <textElement verticalAlignment="Middle">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Header 2]]></text>
                            </staticText>
                        </c:columnHeader>
                        <c:columnFooter style="TableFooter" height="15">
                            <box leftPadding="10">
                                <pen lineColor="#000000"/>
                                <leftPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="15" uuid="6da45801-60da-413d-baf4-c13338db0d80"/>
                                <textElement verticalAlignment="Middle">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Total 2]]></text>
                            </staticText>
                        </c:columnFooter>
                        <c:detailCell height="15">
                            <box leftPadding="10">
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="15" isPrintWhenDetailOverflows="true" uuid="cdc47144-f1c1-4112-8e4f-9301d4b03ce9"/>
                                <text><![CDATA[]]></text>
                            </staticText>
                            <textField>
                                <reportElement x="0" y="0" width="90" height="15" uuid="ff6cedd6-b2c5-4546-ae1b-6d57423f1f92"/>
                                <textFieldExpression><![CDATA[$V{Column2}]]></textFieldExpression>
                            </textField>
                        </c:detailCell>
                    </c:column>
                    <c:column width="100" uuid="c781c258-fc9e-4a2d-82bd-01e2f40a4658">
                        <c:columnHeader style="TableHeader" height="30" rowSpan="2">
                            <box leftPadding="10">
                                <pen lineColor="#000000"/>
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="30" uuid="7540e3b2-5d37-4fe4-91a8-2547940ba5f7"/>
                                <textElement verticalAlignment="Middle">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Header 3]]></text>
                            </staticText>
                        </c:columnHeader>
                        <c:columnFooter style="TableFooter" height="15">
                            <box leftPadding="10">
                                <pen lineColor="#000000"/>
                                <leftPen lineWidth="0.5"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="15" uuid="64482f3d-8d8b-4eed-b71c-142a596219e4"/>
                                <textElement verticalAlignment="Middle">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Total 3]]></text>
                            </staticText>
                        </c:columnFooter>
                        <c:detailCell height="15">
                            <box leftPadding="10">
                                <leftPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textField>
                                <reportElement x="0" y="0" width="90" height="15" uuid="329d33c4-e976-4aa2-8022-40e957727eb7"/>
                                <textFieldExpression><![CDATA[$V{Column3}]]></textFieldExpression>
                            </textField>
                        </c:detailCell>
                    </c:column>
                    <c:columnGroup width="255" uuid="3098567e-0813-4e4a-9aad-58bae2a5b2ab">
                        <c:columnHeader style="TableHeader" height="15">
                            <box>
                                <pen lineWidth="0.5" lineColor="#000000"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="255" height="15" uuid="9b8eb5e6-3655-473a-b2d1-bce80f90ce8f"/>
                                <textElement textAlignment="Center">
                                    <font size="12" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Header 4]]></text>
                            </staticText>
                        </c:columnHeader>
                        <c:column width="155" uuid="e3df35d7-6ce7-4941-a1f0-860fb62afd53">
                            <c:columnHeader style="TableHeader" height="15">
                                <box leftPadding="10">
                                    <pen lineColor="#000000"/>
                                    <topPen lineWidth="0.5"/>
                                    <leftPen lineWidth="0.5"/>
                                    <bottomPen lineWidth="0.5"/>
                                </box>
                                <staticText>
                                    <reportElement x="0" y="0" width="145" height="15" uuid="d0904ae1-535f-4d94-bfe4-881544398d85"/>
                                    <textElement>
                                        <font isBold="true"/>
                                    </textElement>
                                    <text><![CDATA[Header 4.1]]></text>
                                </staticText>
                            </c:columnHeader>
                            <c:columnFooter style="TableFooter" height="15">
                                <box leftPadding="10">
                                    <pen lineColor="#000000"/>
                                    <leftPen lineWidth="0.5"/>
                                </box>
                                <staticText>
                                    <reportElement x="0" y="0" width="145" height="15" uuid="1239625e-5331-40b5-b7c6-80e58fe4859c"/>
                                    <textElement>
                                        <font size="12" isBold="true"/>
                                    </textElement>
                                    <text><![CDATA[Total 4.1]]></text>
                                </staticText>
                            </c:columnFooter>
                            <c:detailCell height="15">
                                <box leftPadding="10">
                                    <leftPen lineWidth="0.5"/>
                                    <bottomPen lineWidth="0.5"/>
                                </box>
                                <textField>
                                    <reportElement x="0" y="0" width="145" height="15" uuid="a777c29e-db77-4564-a35a-64b990469e57"/>
                                    <textFieldExpression><![CDATA[$V{Column4}]]></textFieldExpression>
                                </textField>
                            </c:detailCell>
                        </c:column>
                        <c:column width="100" uuid="898732fe-58d7-4115-8bf7-fbe53da49eb1">
                            <c:columnHeader style="TableHeader" height="15">
                                <box rightPadding="10">
                                    <pen lineColor="#000000"/>
                                    <topPen lineWidth="0.5"/>
                                    <leftPen lineWidth="0.5"/>
                                    <bottomPen lineWidth="0.5"/>
                                </box>
                                <staticText>
                                    <reportElement x="0" y="0" width="90" height="15" uuid="e5247217-993a-44c8-8fc0-d8de72cf93b2"/>
                                    <textElement textAlignment="Right">
                                        <font isBold="true"/>
                                    </textElement>
                                    <text><![CDATA[Header 4.2]]></text>
                                </staticText>
                            </c:columnHeader>
                            <c:columnFooter style="TableFooter" height="15">
                                <box rightPadding="10">
                                    <pen lineColor="#000000"/>
                                    <leftPen lineWidth="0.5"/>
                                </box>
                                <staticText>
                                    <reportElement x="0" y="0" width="90" height="15" uuid="a1ab288e-ae4b-4f12-83a5-e30486bb30d5"/>
                                    <textElement textAlignment="Right">
                                        <font size="12" isBold="true"/>
                                    </textElement>
                                    <text><![CDATA[Total 4.2]]></text>
                                </staticText>
                            </c:columnFooter>
                            <c:detailCell height="15">
                                <box>
                                    <leftPen lineWidth="0.5"/>
                                    <bottomPen lineWidth="0.5"/>
                                </box>
                                <textField>
                                    <reportElement x="0" y="0" width="100" height="15" uuid="db6d906d-9dd3-463c-a8d3-5aae4b6a944f"/>
                                    <textElement textAlignment="Right"/>
                                    <textFieldExpression><![CDATA[$V{Column5}]]></textFieldExpression>
                                </textField>
                            </c:detailCell>
                        </c:column>
                    </c:columnGroup>
                </c:table>
            </componentElement>
        </band>
    </title>
</jasperReport>

【问题讨论】:

    标签: jasper-reports


    【解决方案1】:

    该链接对我不起作用。我当时也没有找到解决办法,所以我尝试了一些不同的方法。如果以下设置有效,您将不需要任何垂直边框:

    表:

    • 布局 = 垂直
    • 位置类型 = 浮点数
    • 拉伸类型 = 相对于带高度
    • 在第一个全带打印 = true

    表格中的文本字段:

    • 位置类型 = 浮点数
    • 技术类型 = 相对于波段高度
    • 透明 = 真
    • 在第一个全带打印 = true
    • 细节溢出 = true
    • 评估时间 = 现在
    • 溢出拉伸 = tue

    如果这不是您想要的,请尝试设置参数。

    【讨论】:

      猜你喜欢
      • 2011-07-18
      • 1970-01-01
      • 2015-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-11
      • 1970-01-01
      相关资源
      最近更新 更多