Jump to content
We've recently updated our Privacy Statement, available here ×

Subreport doesn't float


Recommended Posts

By: Tom Geyzen - tomgeyzen

Subreport doesn't float

2002-12-11 03:01

Hi,

 

I'm having a problem with the positioning of a subreport : it always showes up at the specified y coordinate hence ignoring positionType="Float".

This is the xml :

 

<staticText>

<reportElement x="0" y="40" width="555" height="60" forecolor="#111111" positionType="Float"/>

<textElement textAlignment="Center" lineSpacing="Single">

<font reportFont="Arial_Bold" size="14"/>

</textElement>

<text>Message Content</text>

</staticText>

<textField isStretchWithOverflow = "true">

<reportElement x="10" y="65" width="500" height="100" isRemoveLineWhenBlank="true"/>

<textElement textAlignment="Left" lineSpacing = "Single">

<font size="8" />

</textElement>

<textFieldExpression class="java.lang.String">$F{PAYLOAD}.replace('r', '')</textFieldExpression>

</textField>

<rectangle>

<reportElement x="0" y="65" width="555" height="100" mode="Transparent" positionType="Float"/>

<graphicElement stretchType="RelativeToTallestObject"/>

</rectangle>

 

<!--The subreport with the hit details-->

<subreport isUsingCache="false">

<reportElement x="0" y="150" width="555" height="1" backcolor="#FFFFDD" positionType="Float" isPrintWhenDetailOverflows="true"/>

<subreportParameter name="Id">

<subreportParameterExpression>

$F{PK}

</subreportParameterExpression>

</subreportParameter>

<connectionExpression>

$P{REPORT_CONNECTION}

</connectionExpression>

<subreportExpression class="java.lang.String">

"SUB.jasper"

</subreportExpression>

</subreport>

 

Any ideas anyone ??

 

tia

 

tom

 

 

 

 

By: Boris Klug - bklug

RE: Subreport doesn't float

2003-12-03 06:49

I solved it by myselft. The two subreports overlap so they cant float.

See msg http://sourceforge.net/forum/message.php?msg_id=1609974

 

 

 

 

By: Boris Klug - bklug

RE: Subreport doesn't float

2003-12-03 06:39

I have the same problem - does anybody solve this?

 

I have two subreports in the detail in a master report.

 

 

 

 

By: Teodor Danciu - teodord

RE: Subreport doesn't float

2003-12-03 06:53

 

Hi,

 

I don't have a sample with your XML, Boris, but if you

look at Tom's report, you'll see that he has a subreport

placed at y="150".

He wants this subreport to float if the text field

above stretches downwards.

But the problem is that the text field starts at y="65"

and goes to 65 + 100 = 165.

This means that the subreport and the text field

are in fact overlapping in the report design.

Overlapping elements do not float.

In order for the text field to push the subreport,

there has to be a gap between them, or at least

they should not overlap.

 

In Tom's case, the solution is to modify the height

of the text field from 100 to 85. This way, the bottom

of the text field would be at pixel 149. And since the

subreport will start at pixel 150, then in will be pushed

downwards in case the text field stretches.

 

I hope this helps.

Teodor

 

 

I hope this helps.

Teodor

 

 

 

 

 

By: Boris Klug - bklug

RE: Subreport doesn't float

2003-12-05 07:56

Thank you Theodor!

 

See my message above,

http://sourceforge.net/forum/message.php?msg_id=1609974 solved it - the two subreports overlapped.

 

 

 

 

 

By: Honghai Zhang - haroldzhang

do not see subreport contents displayed

2003-12-05 11:29

Hi,

 

I want a sub report printed in the group footer. Here is the xml

 

<groupFooter>

<band height="600">

<subreport isUsingCache="true">

<reportElement x="0" y="0" width="585" height="500" positionType="Float"/>

<subreportExpression class="java.lang.String">

"EmailSetup.jasper"

</subreportExpression>

</subreport>

</band>

</groupFooter>

 

And here is the subreport EmailSetup.xml:

 

<jasperReport

name="EmailSetup"

pageWidth="585"

pageHeight="842"

leftMargin="0"

rightMargin="0"

topMargin="0"

bottomMargin="0">

 

<detail>

<band height="500">

<staticText>

<reportElement x="0" y="0" width="140" height="10"/>

<textElement>

<font fontName="serif" size="10" pdfFontName="Times-Roman"/>

</textElement>

<text>MSA #</text>

</staticText>

<line>

<reportElement x="140" y="10" width="200" height="0"/>

<graphicElement stretchType="NoStretch"/>

</line>

<staticText>

<reportElement x="340" y="0" width="100" height="10"/>

<textElement textAlignment="Right">

<font fontName="serif" size="10" pdfFontName="Times-Roman"/>

</textElement>

<text>Quote ID #</text>

</staticText>

<line>

<reportElement x="440" y="10" width="145" height="0"/>

<graphicElement stretchType="NoStretch"/>

</line>

</band>

</detail>

 

</jasperReport>

 

But I don't see anything from sub report EmailSetup gets displayed in the main report.

 

Can you see what is wrong with what I am doing?

 

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: do not see subreport contents displayed

2003-12-05 12:31

A field height of 10 is almost certainly too short to show a font size of 10. Try doubling the field height for starters then scale it back as necessary.

 

 

 

 

By: Honghai Zhang - haroldzhang

RE: do not see subreport contents displayed

2003-12-10 07:41

I doubled the field height and I still don't see the sub report being displayed.

 

 

 

 

By: Teodor Danciu - teodord

RE: do not see subreport contents displayed

2003-12-10 07:46

 

Hi,

 

You have not supplied any data source to your

subreport.

I don't see <connectionExpression>

or <dataSourceExpression> used in your example.

 

In this case, the engine has nothing to iterate on and

by default nothing gets generated for the subreport.

However, if you want to see some parts of the

subreport even there is no data for it, use

whenNoDataType="AllSectionsNoDetail" in your

subreport template.

 

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