Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stretch overflowed fields not stretching it's band #22

Open
allgood opened this issue Mar 2, 2020 · 16 comments
Open

Stretch overflowed fields not stretching it's band #22

allgood opened this issue Mar 2, 2020 · 16 comments

Comments

@allgood
Copy link
Contributor

allgood commented Mar 2, 2020

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

@Rctnet
Copy link
Member

Rctnet commented Mar 2, 2020

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

@allgood
Copy link
Contributor Author

allgood commented Mar 2, 2020 via email

@Rctnet
Copy link
Member

Rctnet commented Mar 2, 2020

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

@Rctnet
Copy link
Member

Rctnet commented Mar 2, 2020

remember to check stretch with overflow property in textfield

@allgood
Copy link
Contributor Author

allgood commented Mar 2, 2020

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

@Rctnet
Copy link
Member

Rctnet commented Mar 2, 2020

Here
image

@allgood
Copy link
Contributor Author

allgood commented Mar 2, 2020

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

image

@allgood
Copy link
Contributor Author

allgood commented Mar 2, 2020

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

@allgood
Copy link
Contributor Author

allgood commented Mar 2, 2020

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>

@Rctnet
Copy link
Member

Rctnet commented Mar 2, 2020

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

@allgood
Copy link
Contributor Author

allgood commented Mar 2, 2020

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
Copy link
Contributor Author

allgood commented Mar 2, 2020

Here is a proof of concept of the problem

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

@allgood
Copy link
Contributor Author

allgood commented Mar 3, 2020

@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
Copy link
Contributor Author

allgood commented Mar 3, 2020

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
Copy link
Contributor Author

allgood commented Mar 3, 2020

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
Copy link
Contributor Author

allgood commented Mar 4, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants