Jump to content
We've recently updated our Privacy Statement, available here ×

Element Group


mreeds45

Recommended Posts

Hello All,

 

I am new to jasper reports and am facing a problem with element group and stretch type + position type and stretch with over flow.

The problem is that I have two static text elements and and two text field elements placed like the following inside a frame (stretch type = Relative to Tallest Object) element and the elements are grouped together in an Element Group

Client ID: Text Field (Position Type = fixed relative to top)

Date Opened: Text Field (Position Type = Float)

. The text field elements have their property "Stretch with over flow" checked. When the content in the text field over flows, the label "Date Opened" remains where it is defined (stretch type = Relative to Tallest Object) but the text field in front of "Date Opened" shifts accordingly (stretch type = No Stretch)

I have no idea why the static text "date opened" is not shifting relative to the tallest Object ?

An early response will be highly appreciated. Thanks in advance :)

Kind Regards

Max

Code:
<?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">	<property name="ireport.scriptlethandling" value="0" />	<property name="ireport.encoding" value="UTF-8" />	<import value="java.util.*" />	<import value="net.sf.jasperreports.engine.*" />	<import value="net.sf.jasperreports.engine.data.*" />		<background>			<band height="0"  isSplitAllowed="true" >			</band>		</background>		<title>			<band height="50"  isSplitAllowed="true" >			</band>		</title>		<pageHeader>			<band height="101"  isSplitAllowed="true" >			</band>		</pageHeader>		<columnHeader>			<band height="30"  isSplitAllowed="true" >			</band>		</columnHeader>		<detail>			<band height="100"  isSplitAllowed="true" >				<frame>					<reportElement						x="0"						y="0"						width="106"						height="22"						key="frame-1"						stretchType="RelativeToTallestObject"/>					<box>					<pen lineWidth="1.0" lineColor="#000000"/>					<topPen lineWidth="1.0" lineColor="#000000"/>					<leftPen lineWidth="1.0" lineColor="#000000"/>					<bottomPen lineWidth="1.0" lineColor="#000000"/>					<rightPen lineWidth="1.0" lineColor="#000000"/></box>				</frame>				<elementGroup><!--  Start: 1 !-->				<textField isStretchWithOverflow="true" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >					<reportElement						x="73"						y="0"						width="31"						height="11"						key="textField-1"/>					<box></box>					<textElement>						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>					</textElement>				<textFieldExpression   class="java.lang.String"><![CDATA["1111111111111111111111111111"]]></textFieldExpression>				</textField>				<textField isStretchWithOverflow="true" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >					<reportElement						x="73"						y="11"						width="31"						height="11"						key="textField-2"						positionType="Float"/>					<box></box>					<textElement>						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>					</textElement>				<textFieldExpression   class="java.lang.String"><![CDATA[new SimpleDateFormat("dd/MM/yyyy h.mm a").format(new Date())]]></textFieldExpression>				</textField>				<staticText>					<reportElement						x="1"						y="0"						width="37"						height="11"						key="staticText-1"/>					<box></box>					<textElement>						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>					</textElement>				<text><![CDATA[Client ID: ]]></text>				</staticText>				<staticText>					<reportElement						x="1"						y="11"						width="55"						height="11"						key="staticText-2"						positionType="Float"/>					<box></box>					<textElement>						<font pdfFontName="Helvetica-Bold" size="8" isBold="true"/>					</textElement>				<text><![CDATA[Date Opened: ]]></text>				</staticText>				</elementGroup><!-- End 1 !-->			</band>		</detail>		<columnFooter>			<band height="30"  isSplitAllowed="true" >			</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>
Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

Hi,

 

Thanks for the swift response and my humblest apologies for replying late (coz of sickness :( ). Well I did'nt get your solution at all.I'm not sure how a transparent static text would do the trick ?

Waiting for a favorable reply.

 

Regards.

Max

Link to comment
Share on other sites

  • 2 years later...

Add a white line (invisible) in between the first row and the second row. Use positionType="Float" for the line and the elements below it.

When the text field will stretch, it will push the line which in turn will push the text fields downwards.

 I hope this helps.

G

Link to comment
Share on other sites

  • 11 months later...
  • 1 year later...

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