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

Bug? unnecessary stretch the page header band


ktrinad

Recommended Posts

By: Henri Chen - henrichen

Bug? unnecessary stretch the page header band

2004-05-26 05:58

Hi,

 

I think this bug was introduced since version 0.52 (version 0.50 does not cause such bug).

 

Please Check following two report designs. The #1 don't have the stretch parts while the #2 adds some stretch TextFields.

 

The #2 would unnecessarily expand the page header band downward while there are still a lot of space.

 

Henri Chen

 

------- Report Design #1 -----

 

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="StretchReport"

pageWidth="595"

pageHeight="842"

columnWidth="555"

leftMargin="20"

rightMargin="20"

topMargin="30"

bottomMargin="30"

whenNoDataType="AllSectionsNoDetail">

<group name="title">

<groupHeader>

<band height="15">

<!--id, when-->

<textField>

<reportElement x="0" y="0" width="68" height="15"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Group Header"

</textFieldExpression>

</textField>

</band>

</groupHeader>

</group>

 

<title/>

<pageHeader>

<band height="64">

<!-- fixed parts -->

<textField>

<reportElement x="130" y="0" width="266" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"/>

<textFieldExpression>

"Page Header 1"

</textFieldExpression>

</textField>

<textField>

<reportElement x="130" y="30" width="266" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Bottom" lineSpacing="Single"/>

<textFieldExpression>

"Page Header 2"

</textFieldExpression>

</textField>

</band>

</pageHeader>

<detail/>

<pageFooter/>

</jasperReport>

 

------- Report Design #2 -----

 

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="StretchReport"

pageWidth="595"

pageHeight="842"

columnWidth="555"

leftMargin="20"

rightMargin="20"

topMargin="30"

bottomMargin="30"

whenNoDataType="AllSectionsNoDetail">

<group name="title">

<groupHeader>

<band height="15">

<!--id, when-->

<textField>

<reportElement x="0" y="0" width="68" height="15"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Group Header"

</textFieldExpression>

</textField>

</band>

</groupHeader>

</group>

 

<title/>

<pageHeader>

<band height="64">

<!-- fixed parts -->

<textField>

<reportElement x="130" y="0" width="266" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"/>

<textFieldExpression>

"Page Header 1"

</textFieldExpression>

</textField>

<textField>

<reportElement x="130" y="30" width="266" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Bottom" lineSpacing="Single"/>

<textFieldExpression>

"Page Header 2"

</textFieldExpression>

</textField>

 

<!-- Stretch Parts -->

<textField isBlankWhenNull="true" isStretchWithOverflow="true">

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

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Address"

</textFieldExpression>

</textField>

<textField isBlankWhenNull="true" isStretchWithOverflow="true">

<reportElement x="396" y="0" width="100" height="0" positionType="Float"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Telephone"

</textFieldExpression>

</textField>

<textField isBlankWhenNull="true" isStretchWithOverflow="true">

<reportElement x="396" y="0" width="100" height="0" positionType="Float"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Fax"

</textFieldExpression>

</textField>

</band>

</pageHeader>

<detail/>

<pageFooter/>

</jasperReport>

 

 

 

By: Teodor Danciu - teodord

RE: Bug? unnecessary stretch the page header

2004-05-26 09:41

 

Hi,

 

I remember doing this modification recently.

But I think it is a correction rather than a new bug.

:)

 

In the initial specifications for JasperReports

the intention was that all elements keep their relative

position from the bottom of the band.

In other words, if we have a text field 10 pixels above

the band bottom, these 10 pixels will be conserved

even when the text field stretches, forcing the band

to stretch so that the bottom gap remains in place.

 

This intention was reinforced/confirmed in the

"stretch" sample which has an extra static text

that never prints.

It has some content that says it is a "Space remover".

It is used to remove the extra blank space at the

bottom of the band introduced by the stretching text

fields that have an original height of 0 or 1 pixels.

 

I think you are in the same situation here.

 

From the initial requirements perspective it was

a bug in previous versions, not in the latest versions.

 

Thank you,

Teodor

 

 

 

By: Henri Chen - henrichen

RE: Bug? unnecessary stretch the page header

2004-05-27 01:15

Teodor,

 

I don't quite understand how the "Space remover" works. If the relative position from the bottom of the band has to be kept; then no matter what you put around the "stretched text fields", the band would always stretch since the text fields is stretched.

 

I copy the "space remover" to my original testing design and the band still stretch. How do I make the "Space remover" work ?

 

Henri

 

------- Design with "Space remover" --------

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created using JasperAssistant (http://www.jasperassistant.com) -->

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport

name="StretchReport"

pageWidth="595"

pageHeight="842"

columnWidth="555"

leftMargin="20"

rightMargin="20"

topMargin="30"

bottomMargin="30"

whenNoDataType="AllSectionsNoDetail">

<group name="title">

<groupHeader>

<band height="15">

<!--id, when-->

<textField>

<reportElement x="0" y="0" width="68" height="15"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Group Header"

</textFieldExpression>

</textField>

</band>

</groupHeader>

</group>

 

<title/>

<pageHeader>

<band height="64">

<!-- fixed parts -->

<textField>

<reportElement x="130" y="0" width="266" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"/>

<textFieldExpression>

"Page Header 1"

</textFieldExpression>

</textField>

<textField>

<reportElement x="130" y="30" width="266" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Bottom" lineSpacing="Single"/>

<textFieldExpression>

"Page Header 2"

</textFieldExpression>

</textField>

 

<!-- Stretch Parts -->

<textField isBlankWhenNull="true" isStretchWithOverflow="true">

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

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Address"

</textFieldExpression>

</textField>

<textField isBlankWhenNull="true" isStretchWithOverflow="true">

<reportElement x="396" y="0" width="100" height="0" positionType="Float"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Telephone"

</textFieldExpression>

</textField>

<textField isBlankWhenNull="true" isStretchWithOverflow="true">

<reportElement x="396" y="0" width="100" height="0" positionType="Float"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"/>

<textFieldExpression>

"Fax"

</textFieldExpression>

</textField>

<staticText>

<reportElement positionType="Float" isPrintRepeatedValues="false" x="369" y="1" width="130" height="59" isRemoveLineWhenBlank="true" forecolor="#c0c0c0"/>

<textElement/>

<text><![CDATA[space remover. This static text never prints, but it is used to eliminate the remaining space till the bottom of the band.]]></text>

</staticText>

</band>

</pageHeader>

<detail/>

<pageFooter/>

</jasperReport>

 

 

 

By: Teodor Danciu - teodord

RE: Bug? unnecessary stretch the page header

2004-05-29 10:59

 

Hi,

 

The "space remover" has isRemoveLineWhenBlank="true".

And since it has a printWhenExpression that prevents

it from displaying and in the given situation there

is no other element to share the same vertical space,

the resulting blank space at the bottom of the band

is removed.

 

Try make some testd on the "stretch" samples to see

what happens if you don't have the "space remover"

in place.

 

I hope this helps.

Teodor

 

 

 

By: Henri Chen - henrichen

RE: Bug? unnecessary stretch the page header

2004-06-04 02:37

Dear Teodor,

 

I got that "space remover" works on my design. Thanks.

 

Henri Chen

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