JasperPHP icon indicating copy to clipboard operation
JasperPHP copied to clipboard

Stretch overflowed fields not stretching it's band

Open allgood opened this issue 4 years ago • 16 comments

On a report with two detail bands, the first one have a field that stretchs with its contents, the expected behavior is to move the following band down but it gets overwritten.

Looks like the stretched field isn't stretching its parent band

Image of sample is attached.

image

allgood avatar Mar 02 '20 15:03 allgood

Try check if split type property is "stretch" ou "prevent" in both bands, when you be create bands in JasperSoft Studio, it´s create if split type property with null value

Rctnet avatar Mar 02 '20 17:03 Rctnet

Hi,

I've checked this because bands where overlapping even without the field stretching.

Problem now is that the stretching field doesn't stretch it's parent band height.

Em 2 de março de 2020 14:35:32 BRT, Rogerio Muniz [email protected] escreveu:

Try check if split type property is "stretch" ou "prevent" in both bands, when you be create bands in JasperSoft Studio, it´s create if split type property with null value>

-- > You are receiving this because you authored the thread.> Reply to this email directly or view it on GitHub:> https://github.com/QuilhaSoft/JasperPHP/issues/22#issuecomment-593522525

-- E-mail enviado do meu celular Android usando K-9 Mail. Por favor, desculpe minha brevidade.

allgood avatar Mar 02 '20 17:03 allgood

Hi, a few seconds ago post a possible solution, try update and test again.

Rctnet avatar Mar 02 '20 18:03 Rctnet

remember to check stretch with overflow property in textfield

Rctnet avatar Mar 02 '20 18:03 Rctnet

I'm having trouble on finding this property on Jasper Studio. Field is stretching only if I choose HTML, but there is no "Stretch with overflow" property here.

image

allgood avatar Mar 02 '20 20:03 allgood

Here image

Rctnet avatar Mar 02 '20 20:03 Rctnet

Doesn't show here! Don't know if it is because of any other option, tried with a blank report!

image

allgood avatar Mar 02 '20 21:03 allgood

Looks like it is the textAdjust option on my version, it have CutText, StretchHeight (I'm choosing this), and ScaleFont options!

allgood avatar Mar 02 '20 21:03 allgood

This is how the code ends on the xml:

<textField textAdjust="StretchHeight">
	<reportElement x="0" y="0" width="180" height="18" uuid="5e2f0d45-410f-4627-964a-8f2d311dde90"/>
	<textElement textAlignment="Left" verticalAlignment="Top" markup="html"/>
	<textFieldExpression><![CDATA[$F{text}]]></textFieldExpression>
</textField>

allgood avatar Mar 02 '20 21:03 allgood

image ou

<textField isStretchWithOverflow="true">
				<reportElement x="2" y="4" width="547" height="11" isPrintWhenDetailOverflows="true" uuid="bceaac6a-262b-4b5d-a180-ec3751e5a755">
					<printWhenExpression><![CDATA[$V{total_receb} > 0]]></printWhenExpression>
				</reportElement>
				<textElement>
					<paragraph lineSpacing="Single"/>
				</textElement>
				<textFieldExpression><![CDATA["Recebemos do(a) Sr(a) "+$F{locatarios_nome}+" a importancia acima mencionada de R$"+$V{total_receb}.toString()+" ("+$V{total_receb}.numberToText()+" )"]]></textFieldExpression>
			</textField>

you can add isStretchWithOverflow ou isPrintWhenDetailOverflows, both be make stretch

Rctnet avatar Mar 02 '20 22:03 Rctnet

Tool automatically changes edition of isStretchWithOverflow when saving... looks like the format is changed on my version.

Both with isPrintWhenDetailOverflows selected on jasperstudio and with isStretchWithOverflow added outside jasper studio the same problem happens.

Tomorrow I will try to make a proof of concept of the bug and post here.

allgood avatar Mar 02 '20 22:03 allgood

Here is a proof of concept of the problem

https://drive.google.com/open?id=18M8PLgYcdLyzaz2lrhPxpf5XyTdJnJvh

allgood avatar Mar 02 '20 23:03 allgood

@Rctnet ... found the problem here... I have marked HTML since it was the only way I was able to get all the content, correct is to use none instead.

Anyway, the problem still occurs for HTML.

And on a sidenote, looks like you are testing reportElement for isStretchWithOverflow when the correct is to test the TextField object ($this). You can also add the value that new version of JasperStudio uses. (I will submit a PR with this change in a few minutes).

Another thing is the isPrintWhenDetailOverflows... for me it haves a different meaning, like if the element should appear even if its contents extends the bounds of the parent element.

allgood avatar Mar 03 '20 12:03 allgood

Still some issues.

On the image attached the "Descrição" field have the textAdjust="StretchHeight" parameter. The first field "Sequencia" ends being printed outside its box making the report confusing.

Will try to make another PoC later today so it can be debugged.

image

allgood avatar Mar 03 '20 15:03 allgood

Had some satisfactory results changing the order of the fields on XML, every element placed after the stretching one gets its position affected. It doesn't respect the "relative to top" or "relative to bottom" property.

It is not optimal, but it will do what I need.

allgood avatar Mar 03 '20 18:03 allgood

Just to keep this here:

any field declared AFTER a stretched field on the jrxml file gets its coordinates entirely unpredictable, so fields that are before or on the same line of it, or even fields that must have a fixed position must be declared before. all other fields will apply the offset of the stretched field... even if the field doesn't stretch.

I suppose it can be considered a bug because this is not the jasper reports behavior , but it is possible to work around it if only one field is stretchable and everything bellow it should move down. Things can get messy if two or more stretchable fields lies on the same page.

allgood avatar Mar 04 '20 13:03 allgood