jasperReporter zeigt nicht alles

Alex-B

Grünschnabel
Hallo,

ich habe erst angefangen mit ireport zu arbeiten und habe ein problem, die ich nicht verstehe und daher nicht lösen kann.
ich habe eine einfache liste erstellt
Code:
List<Position> list = new ArrayList<Position>();
				Position p = new Position();
				p.setPos(1);
				p.setProduct("Produkt 1");
				list.add(p);
				Position p2 = new Position();
				p2.setPos(2);
				p2.setProduct("Produkt 2");
				list.add(p2);

JRDataSource ds = new JRBeanCollectionDataSource(list);
				
				jasperReport =
				   JasperCompileManager.compileReport("C:/Dokumente und Einstellungen/report1.jrxml");
				jasperPrint =
				   JasperFillManager.fillReport(jasperReport,
				                          parameter, ds);
				JasperExportManager.exportReportToPdfFile(jasperPrint,
			                          "Example1.pdf");

das problem liegt daran, dass nur das ZWEITE produkt angezeigt wird und erste gar nicht.

ich habe bereits im google geguckt, hat aber nicht geholfen.
vielen dank im voraus
Alx
 
hier ist XML vom Report

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="report1" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="520" leftMargin="55" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Empty">
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<style name="table">
		<box>
			<pen lineWidth="1.0" lineColor="#000000"/>
		</box>
	</style>
	<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1">
		<box>
			<pen lineWidth="1.0" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
		<box>
			<pen lineWidth="0.5" lineColor="#000000"/>
		</box>
	</style>
	<subDataset name="dataset1"/>
	<subDataset name="dataset2"/>
	<subDataset name="Table Dataset 2" whenResourceMissingType="Empty">
		<queryString>
			<![CDATA[]]>
		</queryString>
		<field name="pos" class="java.lang.Integer">
			<fieldDescription><![CDATA[pos]]></fieldDescription>
		</field>
		<field name="product" class="java.lang.String">
			<fieldDescription><![CDATA[product]]></fieldDescription>
		</field>
		<filterExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></filterExpression>
	</subDataset>
	<queryString>
		<![CDATA[]]>
	</queryString>
	<field name="pos" class="java.lang.Integer">
		<fieldDescription><![CDATA[pos]]></fieldDescription>
	</field>
	<field name="product" class="java.lang.String">
		<fieldDescription><![CDATA[product]]></fieldDescription>
	</field>
	<filterExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></filterExpression>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="79" splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="43" splitType="Stretch">
			<line>
				<reportElement x="0" y="40" width="520" height="1" forecolor="#999999"/>
			</line>
		</band>
	</pageHeader>
	<columnHeader>
		<band height="124" splitType="Stretch">
			<frame>
				<reportElement mode="Transparent" x="15" y="0" width="234" height="98" forecolor="#000000" backcolor="#FFFFFF"/>
				<staticText>
					<reportElement x="1" y="0" width="125" height="11"/>
					<textElement>
						<font size="7" isBold="true"/>
					</textElement>
					<text><![CDATA[Auftraggeber (Besuchsanschrift):]]></text>
				</staticText>
				<staticText>
					<reportElement x="1" y="11" width="25" height="10"/>
					<textElement>
						<font size="7"/>
					</textElement>
					<text><![CDATA[KD-Nr.: ]]></text>
				</staticText>
				<textField isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="26" y="11" width="175" height="10"/>
					<textElement>
						<font size="7" isBold="true"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_PARAMETERS_MAP}.get("inserent")]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement x="26" y="20" width="175" height="10"/>
					<textElement>
						<font size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_PARAMETERS_MAP}.get("name1")]]></textFieldExpression>
				</textField>
				<textField isBlankWhenNull="true">
					<reportElement isPrintRepeatedValues="false" x="26" y="29" width="175" height="10"/>
					<textElement>
						<font size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_PARAMETERS_MAP}.get("name2")]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement x="26" y="38" width="175" height="10"/>
					<textElement>
						<font size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_PARAMETERS_MAP}.get("street")]]></textFieldExpression>
				</textField>
				<textField>
					<reportElement x="26" y="47" width="175" height="10"/>
					<textElement>
						<font size="7"/>
					</textElement>
					<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_PARAMETERS_MAP}.get("city")]]></textFieldExpression>
				</textField>
			</frame>
		</band>
	</columnHeader>
	<detail>
		<band height="216" splitType="Stretch">
			<frame>
				<reportElement x="0" y="0" width="520" height="216"/>
				<componentElement>
					<reportElement key="table 1" style="table 1" positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="520" height="216">
						<property name="net.sf.jasperreports.export.pdf.tag.table" value="full"/>
					</reportElement>
					<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
						<datasetRun subDataset="Table Dataset 2">
							<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
						</datasetRun>
						<jr:column width="41">
							<printWhenExpression><![CDATA[$F{pos}]]></printWhenExpression>
							<jr:columnHeader style="table 1_CH" height="19" rowSpan="1">
								<staticText>
									<reportElement x="0" y="0" width="41" height="17"/>
									<textElement textAlignment="Center" verticalAlignment="Middle">
										<font size="10" isBold="true"/>
									</textElement>
									<text><![CDATA[Pos.]]></text>
								</staticText>
							</jr:columnHeader>
							<jr:detailCell style="table 1_TD" height="46" rowSpan="1">
								<textField isBlankWhenNull="true">
									<reportElement x="0" y="0" width="41" height="46"/>
									<textElement/>
									<textFieldExpression class="java.lang.Integer"><![CDATA[$F{pos}]]></textFieldExpression>
								</textField>
							</jr:detailCell>
						</jr:column>
						<jr:column width="298">
							<printWhenExpression><![CDATA[$F{product}]]></printWhenExpression>
							<jr:columnHeader style="table 1_CH" height="19" rowSpan="1">
								<staticText>
									<reportElement positionType="Float" x="9" y="0" width="289" height="17"/>
									<textElement textAlignment="Center" verticalAlignment="Middle">
										<font size="10" isBold="true"/>
									</textElement>
									<text><![CDATA[Produkt]]></text>
								</staticText>
							</jr:columnHeader>
							<jr:detailCell style="table 1_TD" height="46" rowSpan="1">
								<textField isBlankWhenNull="true">
									<reportElement x="0" y="0" width="298" height="46"/>
									<textElement/>
									<textFieldExpression class="java.lang.String"><![CDATA[$F{product}]]></textFieldExpression>
								</textField>
							</jr:detailCell>
						</jr:column>
						<jr:column width="82">
							<jr:columnHeader style="table 1_CH" height="19" rowSpan="1">
								<staticText>
									<reportElement x="0" y="0" width="81" height="17"/>
									<textElement textAlignment="Center" verticalAlignment="Middle">
										<font size="10" isBold="true"/>
									</textElement>
									<text><![CDATA[Hinweise]]></text>
								</staticText>
							</jr:columnHeader>
							<jr:detailCell style="table 1_TD" height="46" rowSpan="1">
								<elementGroup>
									<staticText>
										<reportElement x="12" y="1" width="69" height="10"/>
										<textElement verticalAlignment="Middle">
											<font size="6" isBold="true"/>
										</textElement>
										<text><![CDATA[wie Vorjahr]]></text>
									</staticText>
									<textField>
										<reportElement x="2" y="2" width="8" height="8"/>
										<box rightPadding="0">
											<pen lineWidth="0.75"/>
											<topPen lineWidth="0.75"/>
											<leftPen lineWidth="0.75"/>
											<bottomPen lineWidth="0.75"/>
											<rightPen lineWidth="0.75"/>
										</box>
										<textElement/>
									</textField>
								</elementGroup>
								<elementGroup>
									<staticText>
										<reportElement x="12" y="11" width="69" height="10"/>
										<textElement verticalAlignment="Middle">
											<font size="6" isBold="true"/>
										</textElement>
										<text><![CDATA[laut Anlage
]]></text>
									</staticText>
									<textField>
										<reportElement x="2" y="12" width="8" height="8"/>
										<box rightPadding="0">
											<pen lineWidth="0.75"/>
											<topPen lineWidth="0.75"/>
											<leftPen lineWidth="0.75"/>
											<bottomPen lineWidth="0.75"/>
											<rightPen lineWidth="0.75"/>
										</box>
										<textElement/>
									</textField>
								</elementGroup>
							</jr:detailCell>
						</jr:column>
						<jr:column width="63">
							<jr:columnHeader style="table 1_CH" height="19" rowSpan="1">
								<staticText>
									<reportElement x="0" y="0" width="63" height="17"/>
									<textElement textAlignment="Center" verticalAlignment="Middle">
										<font size="10" isBold="true"/>
									</textElement>
									<text><![CDATA[Preis]]></text>
								</staticText>
							</jr:columnHeader>
							<jr:detailCell style="table 1_TD" height="46" rowSpan="1"/>
						</jr:column>
					</jr:table>
				</componentElement>
			</frame>
		</band>
	</detail>
	<columnFooter>
		<band height="121">
			<elementGroup/>
		</band>
	</columnFooter>
	<pageFooter>
		<band height="42">
			<elementGroup/>
		</band>
	</pageFooter>
</jasperReport>

danke
 
Hallo noch mal,
ich habe herausgefunden, dass das problem an der Tabelle liegt. Ohne tabelle werden alle Produkte angezeigt. fehler kann ich leider noch nicht finde. Wenn jemand mir helfen könnete, wäre ich sehr dankbar.
Alex
 
Zurück