Jump to content

PAGE_NUMBER doesn't work if pages are more than 20


anto75

Recommended Posts

Hi all,

I'm using JasperReport 3.6 and I've created a very simple report for test the variable $V{PAGE_NUMBER}.

When I launch the report by IReport tool it works fine, while when it started from a servlet in my webapp application it doesn't view the total page number in the footer's page (with the standard format 'Page x of y')...

I've created a template with two text field with the $V{PAGE_NUMBER} as content: in the first I using 'now' as time evaluation while in the second I using 'Report'.

I'm starting to believe that maybe the problem can be in other libraries used by my application (that aren't  the classical Jasper lib)... can I'm right? Someone can help me? The strange thing is that if the pages are < 20 it works well...So I think that the problem can be related with syncronization of the same variable $V{PAGE_NUMBER} for the total page,,,sometimes it's valorized, sometimes not.

I attached the source of my template... If someone can helps me...I appreciate it very very much!!

Regards,

Antonella

Code:
<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ProvaNumeroPagineVer3.6" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">	<queryString>		<![CDATA[select 'prova numero di pagine 1' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 2' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 3' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 4' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 5' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 6' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 7' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 8' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 9' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 10' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 11' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 12' as campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 13' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 14' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 15' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 16' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 17' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 18' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 19' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 20' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 21' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 22' campo1 from CUSTOMER where customer_id = 3union select 'prova numero di pagine 23' campo1 from customer where customer_id = 3union select 'prova numero di pagine 24' campo1 from customer where customer_id = 3union select 'prova numero di pagine 25' campo1 from customer where customer_id = 3union select 'prova numero di pagine 26' campo1 from customer where customer_id = 3union select 'prova numero di pagine 27' campo1 from customer where customer_id = 3union select 'prova numero di pagine 28' campo1 from customer where customer_id = 3union select 'prova numero di pagine 29' campo1 from customer where customer_id = 3union select 'prova numero di pagine 30' campo1 from customer where customer_id = 3]]>	</queryString>	<field name="campo1" class="java.lang.String">		<fieldDescription><![CDATA[]]></fieldDescription>	</field>	<background>		<band splitType="Stretch"/>	</background>	<detail>		<band height="703" splitType="Stretch">			<textField>				<reportElement x="0" y="0" width="555" height="20"/>				<textElement textAlignment="Center">					<font size="12"/>				</textElement>				<textFieldExpression class="java.lang.String"><![CDATA[$F{campo1}]]></textFieldExpression>			</textField>		</band>	</detail>	<columnFooter>		<band height="45" splitType="Stretch"/>	</columnFooter>	<pageFooter>		<band height="54" splitType="Stretch">			<textField isStretchWithOverflow="true">				<reportElement x="0" y="15" width="80" height="39" forecolor="#990033"/>				<textElement textAlignment="Right">					<font isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.String"><![CDATA["Pagina "+$V{PAGE_NUMBER}+" di "]]></textFieldExpression>			</textField>			<textField isStretchWithOverflow="true" evaluationTime="Report" isBlankWhenNull="false">				<reportElement x="80" y="15" width="85" height="39" forecolor="#990033"/>				<textElement textAlignment="Center" verticalAlignment="Middle">					<font isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>			</textField>			<textField isStretchWithOverflow="true" evaluationTime="Report" isBlankWhenNull="false">				<reportElement x="207" y="15" width="85" height="39" forecolor="#990033"/>				<textElement textAlignment="Center" verticalAlignment="Middle">					<font isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{COLUMN_NUMBER}]]></textFieldExpression>			</textField>			<textField isStretchWithOverflow="true" evaluationTime="Report" isBlankWhenNull="false">				<reportElement x="377" y="15" width="85" height="39" forecolor="#990033"/>				<textElement textAlignment="Center" verticalAlignment="Middle">					<font isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression>			</textField>			<textField isStretchWithOverflow="true" evaluationTime="Report" isBlankWhenNull="false">				<reportElement x="292" y="15" width="85" height="39" forecolor="#990033"/>				<textElement textAlignment="Center" verticalAlignment="Middle">					<font isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>			</textField>			<textField isStretchWithOverflow="true" evaluationTime="Report" isBlankWhenNull="false">				<reportElement x="462" y="15" width="85" height="39" forecolor="#990033"/>				<textElement textAlignment="Center" verticalAlignment="Middle">					<font isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>			</textField>		</band>	</pageFooter>	<summary>		<band height="42" splitType="Stretch"/>	</summary></jasperReport>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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