Jump to content

function page break in jasper report


Recommended Posts

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

The pagebreak by a group will just work if the result of the groupexpression will change accordingly to the previous result of groupexpression. If you have just one record or if your (dummy)group-expression will always return the same result you won't get a page-break caused by "isStartNewPage" attribute.

That's why the manual page-break element would be helpfull in some cases.


just my two cents.


Link to comment
Share on other sites

  • 1 year later...

"That's why the manual page-break element would be helpfull in some cases."

How can we insert manual page break. Im setting A4 size page and preivew from the Jasper viewer shows perfect. But when I print it is not. Is there any way to insert page break manually wherever we want?

Thanks for your time.


Link to comment
Share on other sites

There is a "Break" element in the "Palette" window. You can insert it in your report and choose "Column Break" or "Page Break". (Sometimes it adds a blank page if you don't control it with the "Print when expression"). I hope this helps you.

Post Edited by charliesuco at 04/27/2010 10:29

I forgot to tell that I am using version 3.7.1

Post Edited by charliesuco at 04/27/2010 11:17
Link to comment
Share on other sites

  • 4 weeks later...


I am facing a peculiar problem with page break and page footer.

Here is an explanation to re create it.

1) create a report with one text field, print it in the detail band.

2) print the same field in the page footer.

3) insert a page break before the field in the detail band.


Put a simple select query which gives you 4-5 values for your field value.


The issue that you will notice with the output is that the page footer will print the value which comes on the next page rather than the value which is coming on the same page.


I am attaching my sample pdf generated for you to look at. The footer value in the sample is printed in blue color to make the distinction from the value in the detail band but actually they both are the same values.

Thanks in advance!!!



<?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">	<queryString>		<![CDATA[select site_id from site]]>	</queryString>	<field name="SITE_ID" class="java.lang.String">		<fieldDescription><![CDATA[]]></fieldDescription>	</field>	<background>		<band splitType="Stretch"/>	</background>	<title>		<band height="79" splitType="Stretch"/>	</title>	<pageHeader>		<band height="35" splitType="Stretch"/>	</pageHeader>	<columnHeader>		<band height="61" splitType="Stretch"/>	</columnHeader>	<detail>		<band height="57" splitType="Stretch">			<textField>				<reportElement x="0" y="33" width="100" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_ID}]]></textFieldExpression>			</textField>			<break>				<reportElement x="0" y="32" width="100" height="1"/>			</break>		</band>	</detail>	<columnFooter>		<band height="45" splitType="Stretch"/>	</columnFooter>	<pageFooter>		<band height="54" splitType="Stretch">			<textField>				<reportElement x="43" y="16" width="100" height="20" forecolor="#3300FF"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[$F{SITE_ID}]]></textFieldExpression>			</textField>		</band>	</pageFooter>	<summary>		<band height="42" splitType="Stretch"/>	</summary></jasperReport>
Link to comment
Share on other sites

  • 2 years later...


Is there anywy to break by value of data in a column?


I would like to put a break in after a certain value of my data changes.

For example I retrieve the data from the database


G1  BB

G1  AA

B2  CC




I would like to group them by the first column

For example I would like to to look like this.






 <insert break at this point once first column value changes>





Link to comment
Share on other sites

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