How to make a page break after group change in table?

0

Hello,

I want to print every group of a table on a new page but if I try it with page breaks jasperserver throws a Null Pointer Exception. Is there anyone who can help me?

 

Stacktrace (page break in the group footer):

java.lang.NullPointerException

java.lang.NullPointerException at net.sf.jasperreports.engine.fill.JRFillBand.isPageBreakInhibited(JRFillBand.java:505) at net.sf.jasperreports.engine.fill.JRFillBreak.prepare(JRFillBreak.java:233) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331) at net.sf.jasperreports.engine.fill.JRFillFrame.prepare(JRFillFrame.java:216) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:379) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:353) at net.sf.jasperreports.engine.fill.JRFillBand.refill(JRFillBand.java:333) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2055) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooter(JRVerticalFiller.java:943) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooters(JRVerticalFiller.java:809) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:299) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:155) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822) at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:655) at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59) at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:203) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

 

robin.koch's picture
Joined: Apr 2 2013 - 6:16am
Last seen: 6 years 4 months ago

1 Answer:

1

Hi Robin,

I assume you are using the Table-Component as you wrote. I'm not very comfortable with this, but page breaking seams easy. Attach a dataset to the table having the group. Activate the property "Start on new page" with the dataset group you like. the table groups start on new pages now. see the example report attached (using foodmart jdbc datasource, works on the Jasperserver, too).

IMHO, Never ever user page breaks in Jasperreports!

Even if I don't know your report, i would say, better build a table-layout report without the table element, possibly as asubreport. You will have more control and flexibility like thi, although it may a bit more work to implement.

Cheers, Thomas

http://www.thomaszimmer.net

Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 5 days 11 hours ago

Thank you, that did it.

robin.koch - 6 years 5 months ago

Exactly what I was looking for thanks a lot.

Lwazi.Nxumalo - 3 years 5 months ago
Feedback