简体   繁体   中英

How to Freeze the column header in iReport / Jasper Reports

I have column headings in column header band which I want to freeze and make details band (where actual data is displayed) to be scrollable.

Here is the Column Header code snippet

<columnHeader>
    <band height="36" splitType="Stretch">
        <staticText>
            <reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="1410" y="0" width="113" height="34" isRemoveLineWhenBlank="true" forecolor="#404040" backcolor="#BBD7EF"/>
            <textElement>
                <font fontName="Trebuchet MS" size="13" isBold="true"/>
            </textElement>
            <text><![CDATA[Extra Hrs Amount]]></text>
        </staticText>
        <staticText>
            <reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="1616" y="0" width="90" height="34" isRemoveLineWhenBlank="true" forecolor="#404040" backcolor="#BBD7EF"/>
            <textElement>
                <font fontName="Trebuchet MS" size="13" isBold="true"/>
            </textElement>
            <text><![CDATA[Parking Fees]]></text>
        </staticText>
        <staticText>
            <reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="1798" y="0" width="92" height="34" isRemoveLineWhenBlank="true" forecolor="#404040" backcolor="#BBD7EF"/>
            <textElement>
                <font fontName="Trebuchet MS" size="13" isBold="true"/>
            </textElement>
            <text><![CDATA[Net Payment]]></text>
        </staticText>
    </band>
</columnHeader>

here is your solution the report x axis less than the <staticText> field x axis ..ie x="1410" y="0" in your code snippet. Reduce the x axis value to your requirement x="10" y ="3". The text will show in column header

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM