JavaDragon
JavaDragon

Reputation: 451

Ireport Line Error in Detail Band

Report output

This is the Report Output, that we are getting on applying single line in detail band, when the item name field gets Stretch with Overflow in iReport the single line remains and provides gap of the overflow area.

Any solution will be helpful.

Upvotes: 1

Views: 185

Answers (1)

Petter Friberg
Petter Friberg

Reputation: 21710

Use the stretchType attribute on the reportElement that you need to adapt to the overflow of other elements (the line, the textField ecc). Set value RelativeToBandHeight or RelativeToTallestObject depending on what you like to achieve.

stretchTypes

NoStretch - The report element preserves its original specified height.

RelativeToBandHeight - The report element adapts its height to match the new height of the report section it is placed on, which has been affected by stretch.

RelativeToTallestObject - Report elements can be made to automatically adapt their height to fit the amount of stretch suffered by the tallest element in the group that they are part of.

If you are drawing a line es.

<line>
    <reportElement stretchType="RelativeToBandHeight" x="1" y="0" width="1" height="20" uuid="2d923fed-08e1-4304-8b06-ef9894bd8181"/>
</line>

However I prefer not to draw lines but to use borders and padding on the textField in the report.

Example

<textField>
   <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="20" uuid="45c316a5-4e29-4247-acb5-2f551e9a8f47"/>
   <box topPadding="2" leftPadding="2" bottomPadding="2" rightPadding="2">
        <pen lineWidth="0.25"/>
        <topPen lineWidth="0.25"/>
        <leftPen lineWidth="0.25"/>
        <bottomPen lineWidth="0.25"/>
        <rightPen lineWidth="0.25"/>
   </box>
   <textFieldExpression><![CDATA[$F{field}]]></textFieldExpression>
</textField>

Upvotes: 1

Related Questions