function page break in jasper report

1

Hi anyone,

may i know is there any page break fucntion in jasper report?

I need to break the page by a group. So what is the instruction in order to break a page by group?

 

chs_rachel86's picture
Joined: Jan 8 2009 - 8:09am
Last seen: 10 years 6 months ago

10 Answers:

0

What about the attribute "isStartNewPage" at the group properties!?!?!?

Just set this to true and you'll be happy! :-)

 

hth

C-Box

C-Box's picture
1622
Joined: Jul 19 2006 - 5:58pm
Last seen: 3 days 15 hours ago
0
Unfortunately, in my case 'isStartNewPage' set to true doesn't work and I have no idea why. Is it bug in 3.1.2? http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=10...
lukep1984's picture
Joined: Dec 3 2008 - 12:34am
Last seen: 10 years 7 months ago
-1

i able to break the page according to the group dy, which is insertpage/columnbreak  under the edit toolbar,but when i use this

features, my report will print the title and column header as well even there is not data inside, may i know how to solve this?

chs_rachel86's picture
Joined: Jan 8 2009 - 8:09am
Last seen: 10 years 6 months ago
0

"So what is the instruction in order to break a page by group?"

I solved this problem by setting appropriate value of minHeightToStartNewPage and printWhenExpression for group.

I hope this would help:-)

lukep1984's picture
Joined: Dec 3 2008 - 12:34am
Last seen: 10 years 7 months ago
0

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.

 

C-Box's picture
1622
Joined: Jul 19 2006 - 5:58pm
Last seen: 3 days 15 hours ago
0

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

 

dhamayanthikd's picture
Joined: Apr 9 2010 - 3:04am
Last seen: 6 years 4 months ago
-1

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
charliesuco's picture
Joined: Apr 27 2010 - 12:53am
Last seen: 9 years 2 months ago
0

Hi,

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

Prasun

 

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 <a href="http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"" target="_blank">http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"</a> 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>
</td></tr></tbody></table>
prasun's picture
4
Joined: Feb 11 2010 - 5:08am
Last seen: 9 years 5 months ago
0

Page breaks usually do strange things, what do you need it for?

charliesuco's picture
Joined: Apr 27 2010 - 12:53am
Last seen: 9 years 2 months ago
0

 

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 CC

G1  BB

G1  AA

B2  CC

B2 BB

B2 AA

 

I would like to group them by the first column

For example I would like to to look like this.

 

G1 CC

G1 BB

G1 AA

 

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

 

B2 CC

B2 BB

B2 AA

jemvural's picture
Joined: Jul 26 2012 - 6:54am
Last seen: 6 years 12 months ago
Feedback
randomness