如何在报告中摆脱这个乐队界限 [英] How to get rid of this band line in report

查看:102
本文介绍了如何在报告中摆脱这个乐队界限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The Line for each record is not displaying at the correct position between records instead it is displaying at the wrong position (MARKED BY THE RED ARROW). In fact I would love to get rid of the line. Any Idea About how to fix it?

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

Below is the jasper report XML file contents.

<?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>


推荐答案

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

You should set Float value for line's positionType attribute. Currently you are using the FixRelativeToBottom value - the line is trying to move down.

像这样:

<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 中)将是:

这篇关于如何在报告中摆脱这个乐队界限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆