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

Strange frame behaviour


tomasd

Recommended Posts

Hi,

I need to have a border around text fields in the report. Each text field should be completely remoed when it contains null value. Fields should be also expanded when text does not fit (stretch with overflow).

 

Problem occurs when one field is stretched and one field is removed. Then the size of the enclosed frame is correct, but consecutive elements (outside of frame) are positioned like frame size is different. It looks like floating position of the next element is computed with frame still containing the removed element.

Everything works fine when the field is not removed...

 

I've attached a report with described situation. It can be previewsd in iReport using Empty Data source. In preview "text" value should normally be positioned right after the frames's border, but it's about 1 cm lower.

Attached are also previews of current report (report-bad.png) and desired report(report-good.png).

Please help, I'm stuck with this problem for over a week :(.

thanks

 tomas
 

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" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">	<parameter name="parameter1" class="java.lang.String" isForPrompting="false">		<defaultValueExpression><![CDATA["Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sed arcu augue, non pulvinar nisl. Vivamus commodo aliquet nibh, et vestibulum felis luctus in. Nunc tempus nisl id eros porta facilisis. Praesent id nulla metus. Duis eleifend, justo imperdiet consectetur lobortis, mi arcu tristique diam, sagittis interdum urna nulla a nisl. Nulla turpis odio, semper ut ultricies et, adipiscing quis tellus. Cras mauris ipsum, dictum elementum commodo eget, rutrum sed dolor. Aenean sollicitudin mi sed massa rutrum vitae cursus massa ultricies. Mauris ipsum dui, tincidunt id imperdiet sed, porttitor nec magna. Quisque quis quam sit amet sem dictum blandit. Donec dolor ante, lobortis et pretium nec, ultricies rhoncus lectus. Praesent in odio a leo vehicula lobortis. Maecenas porttitor erat at sem eleifend vel condimentum dolor gravida. Mauris nec magna eget turpis varius varius et in risus. Sed convallis elementum adipiscing. Mauris rutrum urna at turpis pellentesque volutpat porta est pulvinar. In hac habitasse platea dictumst. Mauris dui velit, condimentum eu feugiat vel, ornare et nunc. Sed sagittis molestie placerat. Ut urna erat, hendrerit eu lobortis sit amet, imperdiet eget est."]]></defaultValueExpression>	</parameter>	<parameter name="parameter2" class="java.lang.String" isForPrompting="false">		<defaultValueExpression><![CDATA[]]></defaultValueExpression>	</parameter>	<parameter name="parameter3" class="java.lang.String" isForPrompting="false">		<defaultValueExpression><![CDATA["text"]]></defaultValueExpression>	</parameter>	<field name="field1" class="java.lang.String">		<fieldDescription><![CDATA[asdfasdfasd]]></fieldDescription>	</field>	<field name="field2" class="java.lang.String"/>	<field name="field3" class="java.lang.String"/>	<title>		<band height="60">			<frame>				<reportElement positionType="Float" x="0" y="0" width="555" height="40" isRemoveLineWhenBlank="true"/>				<box>					<pen lineWidth="1.0"/>					<topPen lineWidth="1.0"/>					<leftPen lineWidth="1.0"/>					<bottomPen lineWidth="1.0"/>					<rightPen lineWidth="1.0"/>				</box>				<textField isStretchWithOverflow="true">					<reportElement positionType="Float" x="0" y="0" width="555" height="20" isRemoveLineWhenBlank="true"/>					<textElement/>					<textFieldExpression class="java.lang.String"><![CDATA[$P{parameter1}]]></textFieldExpression>				</textField>				<textField isStretchWithOverflow="true" isBlankWhenNull="true">					<reportElement positionType="Float" x="0" y="20" width="555" height="20" isRemoveLineWhenBlank="true"/>					<textElement/>					<textFieldExpression class="java.lang.String"><![CDATA[$P{parameter2}]]></textFieldExpression>				</textField>			</frame>			<textField isStretchWithOverflow="true">				<reportElement positionType="Float" x="0" y="40" width="555" height="20" isRemoveLineWhenBlank="true"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[$P{parameter3}]]></textFieldExpression>			</textField>		</band>	</title></jasperReport>
Link to comment
Share on other sites

  • Replies 1
  • 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...