Jump to content
Changes to the Jaspersoft community edition download ×

Regarding creation of table.


nareshknl2bgl

Recommended Posts

Hi All,

I have a question concerning creation of a table in a pdf/jasper report.

The table has following structure.

TABLE
S.NO Hotel_NAME Room Number
1. Leela Place

101

102

103

104

2. Royal Arcade

111

222

333

Column 'Hotel_Name' has one to many relation with the column 'Room Number'

I am using jasper Report 3.7.1 version. I tried it using a LIST component for the column 'ROOM NUMBER'. I am able to display the data correctly. But when the data extends more than a page i face few alignment problems with 3rd column.

Did any one created such a report before whose content extends 'n' number of pages.

Problem : At the end of each page, ending the column 'Room number' by adding a bottom border is missing.

Seems like the Frame keeps extending across multiple pages.

 

Regards,

Naresh. 

 

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" pageWidth="340" pageHeight="842" columnWidth="300" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">	<property name="ireport.zoom" value="1.0"/>	<property name="ireport.x" value="0"/>	<property name="ireport.y" value="0"/>	<subDataset name="dataset1">		<field name="roomNo" class="java.lang.String"/>	</subDataset>	<field name="hotelName" class="java.lang.String"/>	<field name="roomDetailsList" class="java.util.List"/>	<background>		<band splitType="Stretch"/>	</background>	<title>		<band splitType="Stretch"/>	</title>	<pageHeader>		<band splitType="Stretch"/>	</pageHeader>	<columnHeader>		<band height="29" splitType="Stretch">			<staticText>				<reportElement mode="Opaque" x="0" y="0" width="169" height="28" backcolor="#CCCCCC"/>				<box>					<pen lineWidth="0.25"/>					<topPen lineWidth="0.25"/>					<leftPen lineWidth="0.25"/>					<bottomPen lineWidth="0.25"/>					<rightPen lineWidth="0.25"/>				</box>				<textElement textAlignment="Center"/>				<text><![CDATA[HOTEL NAME]]></text>			</staticText>			<staticText>				<reportElement mode="Opaque" x="169" y="1" width="100" height="28" backcolor="#CCCCCC"/>				<box>					<pen lineWidth="0.25"/>					<topPen lineWidth="0.25"/>					<leftPen lineWidth="0.25"/>					<bottomPen lineWidth="0.25"/>					<rightPen lineWidth="0.25"/>				</box>				<textElement textAlignment="Center"/>				<text><![CDATA[ROOM DETAILS]]></text>			</staticText>		</band>	</columnHeader>	<detail>		<band height="20" splitType="Stretch">			<textField isStretchWithOverflow="true">				<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="169" height="19" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>				<box>					<pen lineWidth="0.25"/>					<topPen lineWidth="0.0"/>					<leftPen lineWidth="0.25"/>					<bottomPen lineWidth="0.25"/>					<rightPen lineWidth="0.25"/>				</box>				<textElement textAlignment="Center"/>				<textFieldExpression class="java.lang.String"><![CDATA[$F{hotelName}]]></textFieldExpression>			</textField>			<frame>				<reportElement stretchType="RelativeToTallestObject" x="169" y="0" width="100" height="20" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true">					<property name="net.sf.jasperreports.export.pdf.tag.table" value="full"/>				</reportElement>				<box>					<pen lineWidth="0.25"/>					<topPen lineWidth="0.0"/>					<leftPen lineWidth="0.25"/>					<bottomPen lineWidth="0.25"/>					<rightPen lineWidth="0.25"/>				</box>				<componentElement>					<reportElement x="0" y="0" width="100" height="20" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>					<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">						<datasetRun subDataset="dataset1">							<datasetParameter name="REPORT_DATA_SOURCE">								<datasetParameterExpression><![CDATA[new  net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{roomDetailsList})]]></datasetParameterExpression>							</datasetParameter>							<dataSourceExpression><![CDATA[new  net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{roomDetailsList})]]></dataSourceExpression>						</datasetRun>						<jr:listContents height="20" width="100">							<frame>								<reportElement x="0" y="0" width="100" height="20" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>								<textField>									<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="100" height="20" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>									<box>										<pen lineWidth="0.25"/>										<topPen lineWidth="0.0"/>										<leftPen lineWidth="0.25"/>										<bottomPen lineWidth="0.0"/>										<rightPen lineWidth="0.25"/>									</box>									<textElement textAlignment="Center"/>									<textFieldExpression class="java.lang.String"><![CDATA[$F{roomNo}]]></textFieldExpression>								</textField>							</frame>						</jr:listContents>					</jr:list>				</componentElement>			</frame>		</band>	</detail>	<columnFooter>		<band splitType="Stretch"/>	</columnFooter>	<pageFooter>		<band splitType="Stretch"/>	</pageFooter>	<summary>		<band splitType="Stretch"/>	</summary></jasperReport>
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...