Search code examples
jasper-reports

iReport : set a fixed height for detail band


I'm using iReport with eclipse. I have to display a list of values and I need to set a fixed height for the area (detail band) where will be displayed the values. Let's say 10rows.

Then below this detail band I have two fields that represent sums of the value displayed in the detail.
The sums must be displayed at a specific place in my page: right below the 10rows detail band whether the detail band is full or not. It means that if I have only 6 rows displayed, I must have 4 empty rows below to reach the 10 rows.

If the values displayed take more than 10rows, then a second page is created.

Not sure I am clear, but if anyone can help me on this... Thanks


Solution

  • You can use background band to form a grid structure like below,

    <background>
        <band height="555" splitType="Stretch">
            <rectangle>
                <reportElement x="0" y="59" width="555" height="427" uuid="ee3fa6a5-eddb-4b38-b834-f2658bcf92d1"/>
            </rectangle>
            <line>
                <reportElement x="0" y="95" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="125" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="155" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="185" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="215" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="245" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="275" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="305" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="335" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="365" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="395" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="425" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="0" y="455" width="555" height="1" uuid="4494e946-4ff5-4d57-b3eb-9d64eda302c4"/>
            </line>
            <line>
                <reportElement x="142" y="59" width="1" height="427" uuid="01f3d5fc-9d23-4c7b-96cf-0ff7b3285400"/>
            </line>
            <line>
                <reportElement x="308" y="59" width="1" height="427" uuid="01f3d5fc-9d23-4c7b-96cf-0ff7b3285400"/>
            </line>
            <line>
                <reportElement x="443" y="59" width="1" height="427" uuid="01f3d5fc-9d23-4c7b-96cf-0ff7b3285400"/>
            </line>
            <line>
                <reportElement x="555" y="59" width="1" height="427" uuid="01f3d5fc-9d23-4c7b-96cf-0ff7b3285400"/>
            </line>
        </band>
    </background>
    

    Hope it helps.