Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
761 views
in Technique[技术] by (71.8m points)

jasper reports - How do I place a record into a new page in JasperReports if it overflows the last one?

I'm using Jaspersoft Studio 6.2.0 and JasperReports 6.2.0 library.

I have a report and in the details section some of the records in the table may overflow a page and the rest of its content is written in a new page. Is it possible to the engine realizes that the content overflows the page and print the whole record as the first one in the next page?

Here is how the report is being generated right now: Here is how the report is being generated right now

What I need is that the last record to be printed in the next page instead of the previous page. Is it possible to achieve this result using JasperReports?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is normally avoided by using splitType="Prevent" on the JRBand

Prevent The band starts to render normally, but if the bottom of the page is reached without finishing the band, the whole contents of the band that are already being laid out are moved to the next page. If the band does not fit on the next page, the split occurs normally, as band split prevention is effective only on the first split attempt

example

<detail>
    <band height="20" splitType="Prevent">
    ... your text fields ..
    </band>
</detail>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...