jasperreports liefert falsche seitenanzahl

Status
Nicht offen für weitere Antworten.

rwolf

Bekanntes Mitglied
hi all,

also ich hab nen einfachen reports für ne textbaustein liste
im fuß steht "SEITE " $V(PAGE_NUMBER) "VON" $V(PAGE_COUNT)

wenn ich den ausführen lasse, kriege ich 3 seiten , aber folgende anzeige bzw. folgenden
ausdruck :

seite 1 von 5
seite 2 von 6
seite 3 von 2

beim windows-druckdialog werden 3 Seiten korrekt angegeben

toll ist das ja nicht gerade !



:shock:

kann man das irgendwie beeinflussen ?

:?:
 

rwolf

Bekanntes Mitglied
versionen : jasper-report 1.2.5, iReport 1.2.5,Win-XP-prof DB: mysql Conn: JDBC:ODBC
visualisierung mit report-viewer

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

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
		 name="GLJ_Textbausteine"
		 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">
	<property name="ireport.scriptlethandling" value="2" />
	<property name="ireport.encoding" value="UTF-8" />
	<import value="java.util.*" />
	<import value="net.sf.jasperreports.engine.*" />
	<import value="net.sf.jasperreports.engine.data.*" />

	<queryString><![CDATA[SELECT tb_nr,kurztext,langtext FROM textbaust]]></queryString>

	<field name="tb_nr" class="java.lang.String"/>
	<field name="kurztext" class="java.lang.String"/>
	<field name="langtext" class="java.lang.String"/>

		<background>
			<band height="0"  isSplitAllowed="true" >
			</band>
		</background>
		<title>
			<band height="50"  isSplitAllowed="true" >
				<staticText>
					<reportElement
						x="21"
						y="12"
						width="280"
						height="23"
						key="staticText-1"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement textAlignment="Justified">
						<font fontName="Arial" size="18"/>
					</textElement>
				<text><![CDATA[Textbausteinliste]]></text>
				</staticText>
			</band>
		</title>
		<pageHeader>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</pageHeader>
		<columnHeader>
			<band height="30"  isSplitAllowed="true" >
				<staticText>
					<reportElement
						x="10"
						y="0"
						width="80"
						height="20"
						key="staticText-2"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font fontName="Arial"/>
					</textElement>
				<text><![CDATA[Baustein-Nr.]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="100"
						y="0"
						width="52"
						height="18"
						key="staticText-3"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<text><![CDATA[KurzBez.]]></text>
				</staticText>
				<staticText>
					<reportElement
						x="210"
						y="0"
						width="100"
						height="17"
						key="staticText-4"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<text><![CDATA[Langtext]]></text>
				</staticText>
				<line direction="TopDown">
					<reportElement
						x="0"
						y="20"
						width="520"
						height="0"
						key="line-2"/>
					<graphicElement stretchType="NoStretch"/>
				</line>
			</band>
		</columnHeader>
		<detail>
			<band height="100"  isSplitAllowed="true" >
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="10"
						y="10"
						width="80"
						height="20"
						key="textField-1"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$F{tb_nr}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="99"
						y="9"
						width="100"
						height="20"
						key="textField"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$F{kurztext}]]></textFieldExpression>
				</textField>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="210"
						y="11"
						width="310"
						height="79"
						key="textField"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.String"><![CDATA[$F{langtext}]]></textFieldExpression>
				</textField>
			</band>
		</detail>
		<columnFooter>
			<band height="43"  isSplitAllowed="true" >
				<staticText>
					<reportElement
						x="100"
						y="20"
						width="80"
						height="20"
						key="staticText-5"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<text><![CDATA[Seite Nr.:]]></text>
				</staticText>
				<line direction="TopDown">
					<reportElement
						x="0"
						y="10"
						width="520"
						height="0"
						key="line-3"/>
					<graphicElement stretchType="NoStretch"/>
				</line>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="370"
						y="20"
						width="100"
						height="20"
						key="textField"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$V{PAGE_COUNT}]]></textFieldExpression>
				</textField>
				<staticText>
					<reportElement
						x="300"
						y="20"
						width="50"
						height="20"
						key="staticText-6"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<text><![CDATA[von]]></text>
				</staticText>
				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
					<reportElement
						x="190"
						y="20"
						width="100"
						height="20"
						key="textField"/>
					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
					<textElement>
						<font/>
					</textElement>
				<textFieldExpression   class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
				</textField>
			</band>
		</columnFooter>
		<pageFooter>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</pageFooter>
		<lastPageFooter>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</lastPageFooter>
		<summary>
			<band height="50"  isSplitAllowed="true" >
			</band>
		</summary>
</jasperReport>

muß halt erstmal erfahrung mit jasper u. ireport sammeln..

hab das gleiche auch mit mini-app und visualisierung mit report-viewer unter eclipse probiert,
dasselbe seitenzahl-problem !
 

rwolf

Bekanntes Mitglied
scheint keinem aufgefallen zu sein , oder gibt es keine Lösung ?

hier noch das bißchen java-code :
Code:
import java.util.*;

import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.*;
import java.sql.*;
import sun.jdbc.odbc.*;

public class Testrpt
{
	public static void main(String args[])
	{
		JasperReport jaspRpt;
		JasperPrint jaspPrt;
		HashMap params = new HashMap();
		//params.put("P1","Hallo Welt von Wolf für JRPT");
		//params.put("KURZBEZ","WS");
		Properties p = new Properties();
		p.put("user","root");
		//p.put("password","root");
		
		String c_kette = "jdbc:odbc:DB_GLJ05;";
		try
		{
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		
		try
		{
			Connection cn;
			Driver drv = (Driver) new JdbcOdbcDriver();
			cn = (Connection) drv.connect(c_kette,p);

			//-checken auf Ergebnis von SQL
			/*
			Statement stm = cn.createStatement();
			ResultSet res = stm.executeQuery("SELECT * FROM users");
			while(res.next())
			{
				System.out.println(res.getInt(1));
			}
			*/

			//- Report hat eigenen SQL-String
			jaspRpt = JasperCompileManager.compileReport("C:/eclipse-SDK-3.2-win32/GLJ_Textbausteine1.jrxml");
			jaspPrt = JasperFillManager.fillReport(jaspRpt, params, cn);
						
		    JasperViewer.viewReport(jaspPrt);			
		}
		catch (JRException jree) 
		{
			System.err.println(jree);
		}
		catch (SQLException sqle)
		{
			System.err.println(sqle);
		}
	}
	
	
}
 
G

Gast

Gast
Hallo.

Die Variable $V(Page_Count) enhält meiner Meinung die Anzahl der Elemente aus der Detail Section. Das heißt die Werte sind wahrscheinlich korrekt.
 
Status
Nicht offen für weitere Antworten.

Neue Themen


Oben