By: Bjarte Andre Eide - baeide
Promblem with isReprintHeaderOnEachPage
2003-01-07 08:16
Hello!
I am having some problems with the "isReprintHeaderOnEachPage" attribute on the group-element.
I am using JasperReport 0.4.4 and jdk-1.4.1
Because "jasperreport.dtd" only allows me to have one element of <pageHeader> I'm using groups to simulate
multiple pageheaders.
The skeleton of my report is the following:
<group name="grp_title">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
.
.
.
</groupHeader>
<group>
<group name="grp_head" isReprintHeaderOnEachPage="true">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
.
.
.
</groupHeader>
</group>
<group name="grp_expanding">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
<ban>
<!-- This group contains textFields with the
"isStretchWithOverflow"-attribute set to "true"
-->
</ban>
</groupHeader>
</group>
<group name="grp_lastPage" isStartNewPage="true">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
</groupHeader>
</group>
<pageHeader>
<band height="80">
.
.
.
</band>
</pageHeader>
<pageFooter>
<band height="30">
.
.
.
</band>
</pageFooter>
--------------------------------------------------------------------------
My DataSource consists of one single row.
The first page is generated correctly:
<pageHeader>
<group name="grp_title">
<group name="grp_head" isReprintHeaderOnEachPage="true">
<group name="grp_expanding">
<pageFooter>
If the content of the textfields in "grp_expanding" is causing overflow, new pages will be generated. I would expect the layout of these pages to be:
<pagHeader>
<group name="grp_head" isReprintHeaderOnEachPage="true">
<group name="grp_expanding">
<pageFooter>
, but JasperReports give me the following:
<pagHeader>
<group name="grp_expanding">
<pageFooter>
The last page I would expect to be:
<pagHeader>
<group name="grp_head" isReprintHeaderOnEachPage="true">
<group name="grp_lastPage" isStartNewPage="true">
<pageFooter>
,but the result is:
<pagHeader>
<group name="grp_lastPage" isStartNewPage="true">
<pageFooter>
As you can see is the group "grp_head" only printed on the first page.
Is there anyone who can give me a hint on how I can come around this ?
Thanks!
Bjarte
By: Teodor Danciu - teodord
RE: Promblem with isReprintHeaderOnEachPage
2003-01-07 08:23
Hi,
I don't think you'll get it through this way.
If you only could explain why is it that you
need multiple <pageHeader> sections,
we could find a different solution.
Thank you,
Teodor
By: Bjarte Andre Eide - baeide
RE: Promblem with isReprintHeaderOnEachPage
2003-01-07 11:01
Hi!
Thank you for your quick response.
My PageHeader consists of three parts in the following order:
1. Company logo, address, email etc.
This is to be printed on every page. (Just like a pre-printed sheet)
2. Report title
This part should only apear on the first page.
3. Summary Line
This should be printed on every page.
This result in the following logicallly pageheader I need to find a solution for:
<pageHeader>
<band>
</band>
</pageHeader>
<pageHeader>
<band>
<printWhenExpression>new java.lang.Boolean($V{PAGE_NUMBER}.intValue() == 1)</printWhenExpression>
</band>
</pageHeader>
<pageHeader>
<band>
</band>
</pageHeader>
I hope this will clarify the problem.
Best Regards.
Bjarte.
By: Vital - vitalsim
RE: Promblem with isReprintHeaderOnEachPage
2003-01-08 02:04
Hi,
There is a simple solution to your requirement ...
You just need to put the company logo, address and email details both in the Title and the Page Header bands.
Title band also contains your report title. Put your Summary Line in the page footer.
Now use the PrintWhenExpression attribute for the fields placed in the page header (company logo, address, email) with the following expression so that it prints the information from the second page onwards (this is required, as the title band already prints these details once in the first page):
new Boolean( ($V{PAGE_NUMBER}).intValue()>1 )
Hope I didn't confuse you too much.
I had tested this and following in the XML code for the report.
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="test"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<variable name="Field" class="java.lang.String" resetType="Report" calculation="System">
<initialValueExpression>new String("Overflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text") </initialValueExpression>
</variable>
<title>
<band height="88">
<staticText>
<reportElement
mode="Transparent"
x="78"
y="9"
width="433"
height="26"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica" size="20" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Company Logo, address, email etc stuff....]]></text>
</staticText>
<staticText>
<reportElement
mode="Transparent"
x="154"
y="57"
width="247"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica-Bold" size="16" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Report Title]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="46">
<staticText>
<reportElement
mode="Transparent"
x="80"
y="11"
width="433"
height="26"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false">
<printWhenExpression>
new Boolean( ($V{PAGE_NUMBER}).intValue()>1 )
</printWhenExpression>
</reportElement>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica" size="20" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Company Logo, address, email etc stuff....]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="5">
</band>
</columnHeader>
<detail>
<band height="50">
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="221"
y="9"
width="59"
height="23"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String">$V{Field}</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="4">
</band>
</columnFooter>
<pageFooter>
<band height="50">
<staticText>
<reportElement
mode="Transparent"
x="168"
y="7"
width="240"
height="31"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica-Bold" size="14" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Your summary line goes here...]]></text>
</staticText>
</band>
</pageFooter>
<summary>
<band height="50">
</band>
</summary>
</jasperReport>
Rgds,
Vital
Promblem with isReprintHeaderOnEachPage
2003-01-07 08:16
Hello!
I am having some problems with the "isReprintHeaderOnEachPage" attribute on the group-element.
I am using JasperReport 0.4.4 and jdk-1.4.1
Because "jasperreport.dtd" only allows me to have one element of <pageHeader> I'm using groups to simulate
multiple pageheaders.
The skeleton of my report is the following:
<group name="grp_title">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
.
.
.
</groupHeader>
<group>
<group name="grp_head" isReprintHeaderOnEachPage="true">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
.
.
.
</groupHeader>
</group>
<group name="grp_expanding">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
<ban>
<!-- This group contains textFields with the
"isStretchWithOverflow"-attribute set to "true"
-->
</ban>
</groupHeader>
</group>
<group name="grp_lastPage" isStartNewPage="true">
<groupExpression>$F{ord_id}</groupExpression>
<groupHeader>
</groupHeader>
</group>
<pageHeader>
<band height="80">
.
.
.
</band>
</pageHeader>
<pageFooter>
<band height="30">
.
.
.
</band>
</pageFooter>
--------------------------------------------------------------------------
My DataSource consists of one single row.
The first page is generated correctly:
<pageHeader>
<group name="grp_title">
<group name="grp_head" isReprintHeaderOnEachPage="true">
<group name="grp_expanding">
<pageFooter>
If the content of the textfields in "grp_expanding" is causing overflow, new pages will be generated. I would expect the layout of these pages to be:
<pagHeader>
<group name="grp_head" isReprintHeaderOnEachPage="true">
<group name="grp_expanding">
<pageFooter>
, but JasperReports give me the following:
<pagHeader>
<group name="grp_expanding">
<pageFooter>
The last page I would expect to be:
<pagHeader>
<group name="grp_head" isReprintHeaderOnEachPage="true">
<group name="grp_lastPage" isStartNewPage="true">
<pageFooter>
,but the result is:
<pagHeader>
<group name="grp_lastPage" isStartNewPage="true">
<pageFooter>
As you can see is the group "grp_head" only printed on the first page.
Is there anyone who can give me a hint on how I can come around this ?
Thanks!
Bjarte
By: Teodor Danciu - teodord
RE: Promblem with isReprintHeaderOnEachPage
2003-01-07 08:23
Hi,
I don't think you'll get it through this way.
If you only could explain why is it that you
need multiple <pageHeader> sections,
we could find a different solution.
Thank you,
Teodor
By: Bjarte Andre Eide - baeide
RE: Promblem with isReprintHeaderOnEachPage
2003-01-07 11:01
Hi!
Thank you for your quick response.
My PageHeader consists of three parts in the following order:
1. Company logo, address, email etc.
This is to be printed on every page. (Just like a pre-printed sheet)
2. Report title
This part should only apear on the first page.
3. Summary Line
This should be printed on every page.
This result in the following logicallly pageheader I need to find a solution for:
<pageHeader>
<band>
</band>
</pageHeader>
<pageHeader>
<band>
<printWhenExpression>new java.lang.Boolean($V{PAGE_NUMBER}.intValue() == 1)</printWhenExpression>
</band>
</pageHeader>
<pageHeader>
<band>
</band>
</pageHeader>
I hope this will clarify the problem.
Best Regards.
Bjarte.
By: Vital - vitalsim
RE: Promblem with isReprintHeaderOnEachPage
2003-01-08 02:04
Hi,
There is a simple solution to your requirement ...
You just need to put the company logo, address and email details both in the Title and the Page Header bands.
Title band also contains your report title. Put your Summary Line in the page footer.
Now use the PrintWhenExpression attribute for the fields placed in the page header (company logo, address, email) with the following expression so that it prints the information from the second page onwards (this is required, as the title band already prints these details once in the first page):
new Boolean( ($V{PAGE_NUMBER}).intValue()>1 )
Hope I didn't confuse you too much.
I had tested this and following in the XML code for the report.
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="test"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<variable name="Field" class="java.lang.String" resetType="Report" calculation="System">
<initialValueExpression>new String("Overflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text\nOverflowig text") </initialValueExpression>
</variable>
<title>
<band height="88">
<staticText>
<reportElement
mode="Transparent"
x="78"
y="9"
width="433"
height="26"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica" size="20" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Company Logo, address, email etc stuff....]]></text>
</staticText>
<staticText>
<reportElement
mode="Transparent"
x="154"
y="57"
width="247"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica-Bold" size="16" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Report Title]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="46">
<staticText>
<reportElement
mode="Transparent"
x="80"
y="11"
width="433"
height="26"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false">
<printWhenExpression>
new Boolean( ($V{PAGE_NUMBER}).intValue()>1 )
</printWhenExpression>
</reportElement>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica" size="20" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Company Logo, address, email etc stuff....]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="5">
</band>
</columnHeader>
<detail>
<band height="50">
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="221"
y="9"
width="59"
height="23"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String">$V{Field}</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="4">
</band>
</columnFooter>
<pageFooter>
<band height="50">
<staticText>
<reportElement
mode="Transparent"
x="168"
y="7"
width="240"
height="31"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Center" lineSpacing="Single">
<font fontName="" pdfFontName="Helvetica-Bold" size="14" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Your summary line goes here...]]></text>
</staticText>
</band>
</pageFooter>
<summary>
<band height="50">
</band>
</summary>
</jasperReport>
Rgds,
Vital
0 Answers:
No answers yet