Jump to content
Changes to the Jaspersoft community edition download ×

Stretch behaviour of elements


Recommended Posts

By: Makarand - mkharche

Stretch behaviour of elements

2005-12-16 00:51

I have 2 groups - ItemGroup and LineItemGroup in the Jasper report design. An item contains multiple line items. For an element in the item group as well as the line item group, i have the following configuration -

 

stretch with overflow = true

stretch type = relative to tallest object

position type = float

 

It so happens that the line item element overlaps with the item element. Anyone can explain this behaviour ???

 

Take the example of the northwind orderlist i.e. the first jasper report sample provided with the jasper bundle, Asuuming that some country has its name as 100 letters long, what should be the configuration of the elements so that they do not overlap, and the report looks gracefull

 

- thanks.

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-16 01:03

I think you don't need stretch type = relative to tallest object. Can you try with stretch type = no stretct?

 

HTH,

Lucian

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-16 01:27

Hi,

Thanks for the prompt reply, however, now I am facing with another problem, The item group element wont stretch even when its "stretch with overflow" is set to true.

 

Is it not true that if an element's "stretch with overflow" is true, then it doesnt matter how much content it carries. The element will stretch and the band will stretch too with it. Also, all other bands to be printed below it will be shifted down on other following pages and printed, so that there is no loss of information due to overlap ?

 

Also, in no case do the bands overlap.

 

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-16 03:53

That's strange. Do you have a sample where we could replicate this?

 

Regards,

Lucian

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-16 04:17

Hi Lucian,

 

Can you tell me what can cause a textfield element to not stretch even when stretch with overflow=true, the textfield being a part of a non-details band.

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-16 04:26

I don't know. Which band exactly does the field lie on?

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-16 05:34

The field lies on an ItemsGroupHeader, custom made group.

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-16 05:40

What do you mean by custom made group? Is it a <group><groupHeader> band or something else?

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-16 06:01

yes ... Its a <group><groupHeader> band. I also saw some similar topics in the "Help" forum but they were unanswered.

 

http://sourceforge.net/forum/message.php?msg_id=3386851

 

http://sourceforge.net/forum/message.php?msg_id=3035912

 

This seems to be a valid problem. Thanks for your replies.

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-16 06:10

I don't know what could be wrong.

 

If you could post a sample to replicate the issue, it would be easier to figure it out.

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-16 06:34

In breif, following is the problem graphically :

 

--------------------------------

|itemName| |itemDescription| - lineItem Group

--------------------------------

--------------------------------

Above Item consists of following - static text

--------------------------------

 

--------------------------------

details band.

--------------------------------

 

 

Now, according to the design above, The itemName and itemDescription just wont stretch.

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-16 06:29

Hi Lucian,

 

Following is an excerpt from the report template :

 

 

<group name="lineItemGroup" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" >

<groupExpression><![CDATA[$F{item.id}]]></groupExpression>

<groupHeader>

<band height="42" isSplitAllowed="true" >

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

<textField isStretchWithOverflow="true" pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="463"

y="0"

width="69"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-117"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{item.price.extendedSellingPrice}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="519"

y="5"

width="9"

height="7"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-32"

stretchType="RelativeToTallestObject"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression>

</reportElement>

<box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.Integer"><![CDATA[$F{totalLineItemsInItem}]]></textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="2"

y="0"

width="51"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-111"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="Thin" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.Integer"><![CDATA[$V{ITEM_SER_NO}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="53"

y="0"

width="93"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-112"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{item.name}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="146"

y="0"

width="128"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-113"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{item.description}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="335"

y="0"

width="64"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-115"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{item.price.extendedListPrice}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="274"

y="0"

width="61"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-114"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.Integer"><![CDATA[$F{item.quantity}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="399"

y="0"

width="64"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-116"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression>

</reportElement>

<box topBorder="Thin" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[new java.text.DecimalFormat("##############0.00").format($F{item.price.discountPercent}.doubleValue())+"%"]]></textFieldExpression>

</textField>

<staticText>

<reportElement

mode="Transparent"

x="2"

y="24"

width="530"

height="18"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-18"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false">

<printWhenExpression><![CDATA[new Boolean(($P{SHOW_QUOTE}.booleanValue() == true) && ($P{SHOW_QUOTE_DETAIL}.booleanValue() == true) && $F{totalLineItemsInItem}.intValue() > 0)]]></printWhenExpression>

</reportElement>

<box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="Thin" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/>

<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[ Above configuration consists of the following items: ]]></text>

</staticText>

</band>

</groupHeader>

<groupFooter>

<band height="0" isSplitAllowed="true" >

</band>

</groupFooter>

</group>

 

 

 

 

 

 

The elements from this group, no matter what is done to them i.e. even if all the textFields and the staticFields are wrapped inside an <elementGroup> tag and their stretch behaviour is set to Relative to the tallest/nostretch, they dont seem to stretch, though the stretch when overflow attribute is set to true.

 

 

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-16 09:02

Text elements with delayed evaluation do not stretch. This is the case with your text element.

 

Regards,

Lucian

 

 

By: Makarand - mkharche

RE: Stretch behaviour of elements

2005-12-19 06:00

Hi Lucian,

 

Thanks for your help. Your solution helped me solve half of my problem. However, this is what happens now :

I have the following design

 

--------------------------------

|itemName| |itemDescription| -lineItem Group

--------------------------------

--------------------------------

Above Item consists of following -static text

--------------------------------

 

--------------------------------

details band.

--------------------------------

 

I have the following config :

 

itemName, itemDescription ->

position - fix relative to top.

stretch - relative to tallest

evaluation time - now.

 

static text ->

position - fix relative to bottom.

stretch - no stretch.

 

In this config, when the itemDescription overflows, it is handled correctly, however, a blank line gets left after it, before the static text. Can you expain this ?

 

Thanks again for your replies.

 

 

 

By: Lucian Chirita - lucianc

RE: Stretch behaviour of elements

2005-12-21 03:08

Why do you have stretch - relative to tallest?

 

I can't explain you the behaviuor unless you post the JRXML fragment.

 

Regards,

Lucian

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