如何在报告中摆脱这个乐队的界限

时间:2016-10-11 12:17:39

标签: jasper-reports

1

每条记录的行不显示在记录之间的正确位置,而是显示在错误的位置(由红色箭头标记)。事实上,我很想摆脱这条线。关于如何解决它的任何想法?

以下是jasper报告XML文件内容。

<?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="patientreceiptreportsubreport" pageWidth="500" pageHeight="802" columnWidth="500" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="48657e21-be23-4f69-be3f-450dbbefbea5">
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
    <style name="Detail" fontName="Arial" fontSize="12"/>
    <field name="productServiceName" class="java.lang.String"/>
    <field name="cdate" class="java.util.Date"/>
    <field name="transactionResult" class="java.lang.String"/>
    <columnHeader>
        <band height="36" splitType="Stretch">
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="35" width="481" height="1" uuid="b50e34d4-69d0-4c76-abbc-52923dfeb133"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
            <staticText>
                <reportElement style="Column header" x="10" y="15" width="158" height="19" forecolor="#000000" uuid="b19d024d-9f1a-402c-8af5-863cc9139414"/>
                <textElement>
                    <font fontName="SansSerif" size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[TEST NAME/DESCRIPTION]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" x="336" y="15" width="74" height="19" forecolor="#000000" uuid="c8aedac6-920c-4ede-8ced-d9aece5bdca4"/>
                <textElement>
                    <font fontName="SansSerif" size="10"/>
                </textElement>
                <text><![CDATA[DATE:]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="59" splitType="Stretch">
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="15" width="481" height="1" uuid="89f624c9-f0e6-4363-a8a9-49d64990e262"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
            <textField>
                <reportElement style="Detail" x="9" y="0" width="30" height="15" uuid="519c3624-5c33-4656-89a6-0e4374b86f13"/>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="Detail" x="336" y="0" width="62" height="15" uuid="78def88b-bdcc-42de-9426-3b1e84853fe2"/>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{cdate}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="Detail" x="39" y="1" width="129" height="14" uuid="1cb312b2-1367-499b-a603-aaca310b2ef1"/>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{productServiceName}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true">
                <reportElement x="10" y="21" width="470" height="30" uuid="7fee676c-39ae-4bd8-80c2-50dab2c1641f"/>
                <textFieldExpression><![CDATA[$F{transactionResult}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>

1 个答案:

答案 0 :(得分:2)

您应为行的 positionType 属性设置 Float 值。目前您正在使用 FixRelativeToBottom 值 - 该行正在尝试向下移动。

像这样:

<line>
    <reportElement positionType="Float" x="0" y="15" width="481" height="1"/>
    <graphicElement>
        <pen lineWidth="0.5" lineColor="#999999"/>
    </graphicElement>
</line>

您的模板将是:

<?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="patientreceiptreportsubreport" pageWidth="500" pageHeight="802" columnWidth="500" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="48657e21-be23-4f69-be3f-450dbbefbea5">
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
    <style name="Detail" fontName="Arial" fontSize="12"/>
    <field name="productServiceName" class="java.lang.String"/>
    <field name="cdate" class="java.util.Date"/>
    <field name="transactionResult" class="java.lang.String"/>
    <columnHeader>
        <band height="36" splitType="Stretch">
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="35" width="481" height="1" uuid="b50e34d4-69d0-4c76-abbc-52923dfeb133"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
            <staticText>
                <reportElement style="Column header" x="10" y="15" width="158" height="19" forecolor="#000000" uuid="b19d024d-9f1a-402c-8af5-863cc9139414"/>
                <textElement>
                    <font fontName="SansSerif" size="10" isBold="true"/>
                </textElement>
                <text><![CDATA[TEST NAME/DESCRIPTION]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" x="336" y="15" width="74" height="19" forecolor="#000000" uuid="c8aedac6-920c-4ede-8ced-d9aece5bdca4"/>
                <textElement>
                    <font fontName="SansSerif" size="10"/>
                </textElement>
                <text><![CDATA[DATE:]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="59" splitType="Stretch">
            <line>
                <reportElement positionType="Float" x="0" y="15" width="481" height="1" uuid="89f624c9-f0e6-4363-a8a9-49d64990e262"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
            <textField>
                <reportElement style="Detail" x="9" y="0" width="30" height="15" uuid="519c3624-5c33-4656-89a6-0e4374b86f13"/>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="Detail" x="336" y="0" width="62" height="15" uuid="78def88b-bdcc-42de-9426-3b1e84853fe2"/>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{cdate}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="Detail" x="39" y="1" width="129" height="14" uuid="1cb312b2-1367-499b-a603-aaca310b2ef1"/>
                <textElement>
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{productServiceName}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true">
                <reportElement x="10" y="21" width="470" height="30" uuid="7fee676c-39ae-4bd8-80c2-50dab2c1641f"/>
                <textFieldExpression><![CDATA[$F{transactionResult}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>

结果(在 JSS 中)将是:

The result in JSS