Jump to content
Changes to the Jaspersoft community edition download ×

Subreport stretching


Recommended Posts

By: Chuck Deal - cdeal

Subreport stretching

2003-04-22 14:01

I have a report that contains a group with 6 subreports. Each subreport has a label (staticText) associated with it located at the same x coordinate as the subreport. The problem is that because the subreports can be many lines high, the subreports "Float" down the page before they start printing, but the labels do not float donw the page when the subreport stretches. I also tried to put the label and the subreport in an elementGroup, but that did not help either. I also, made sure that the two subreports did not "touch" (in the case provided they are separted by 12 pixels.

 

Is this the expected behavior? What are my possible solutions?

 

Here is a snippet of the XML:

 

<staticText>

<reportElement positionType="Float" x="10" y="105" width="80" height="12"/>

<textElement textAlignment="Center">

<font reportFont="TimesBold"/>

</textElement>

<text><![CDATA[Paragraph(s):]]></text>

</staticText>

<subreport>

<reportElement positionType="Float" x="95" y="105" width="450" height="12"/>

<subreportParameter name="primaryType">

<subreportParameterExpression><![CDATA["PLAN"]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="infoType">

<subreportParameterExpression><![CDATA["paragraph"]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="planId">

<subreportParameterExpression><![CDATA[($P{planId} != null ? $P{planId} : new Integer(-1))]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{ReportPath} + "TestInfoSubreport.jasper"]]></subreportExpression>

</subreport>

<staticText>

<reportElement positionType="Float" x="10" y="125" width="80" height="12"/>

<textElement textAlignment="Center">

<font reportFont="TimesBold"/>

</textElement>

<text><![CDATA[build(s):]]></text>

</staticText>

<subreport>

<reportElement positionType="Float" x="95" y="125" width="450" height="12"/>

<subreportParameter name="primaryType">

<subreportParameterExpression><![CDATA["PLAN"]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="infoType">

<subreportParameterExpression><![CDATA["build"]]></subreportParameterExpression>

</subreportParameter>

<subreportParameter name="planId">

<subreportParameterExpression><![CDATA[($P{planId} != null ? $P{planId} : new Integer(-1))]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA[$P{ReportPath} + "TestInfoSubreport.jasper"]]></subreportExpression>

</subreport>

 

 

 

 

 

By: Teodor Danciu - teodord

RE: Subreport stretching

2003-04-22 20:58

 

Hi,

 

The static texts do not float along with the subreport

because there is no other element to push them

downward.

 

The subreport floats because there is the previous

subreport above it to push downwards.

But there is nothing to push the static texts and

they remain on their initial positions.

 

To achieve the desired effect, you can use an

invisible horizontal line (white line) wide enough

to between each static text - subreport pair.

The line will be pushed downwards if it has positionType="Float" and in turn will push both the next static text and subreport, if it is wide enough.

 

Another approach would be to put each static text - subreport pair in its own band, using the dummy groups trick.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...