Jump to content
We've recently updated our Privacy Statement, available here ×

michael.samir.g

Members
  • Posts

    1
  • Joined

  • Last visited

michael.samir.g's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I have a jasper report that has main report and detail report as a list, the data is being sent from server side Java as a java bean that has some attributes including a list of another Java bean, this list is used to fill the detail list, the problem is that, the client need that each detail record should be in a separate page I already try to use Break at end of the list layout, but when I try to generate the report I got the error: Caused by: java.lang.NullPointerException at net.sf.jasperreports.engine.fill.JRFillBreak.prepare(JRFillBreak.java:218) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:537) at net.sf.jasperreports.components.list.FillListContents.prepare(FillListContents.java:92) at net.sf.jasperreports.components.list.VerticalFillList.fillContents(VerticalFillList.java:164) at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:111) at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:537) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:411) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:386) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2024) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:748) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582) at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:414) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:121) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:667) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:983)[/code] Here's the java code for generating the report: due to sensitive client information I couldn't provide the exact code but the same structure Report Bean public class ReportBean implements Serializable { // Main attributes used in the Main report Header and Footer private String attr1; private String attr2; private List<DetailBean> list; // setters and getters}[/code]Detail Bean public class DetailBean implements Serializable { // Detail attributes used in the list details to show detail records private String attr1; private String attr2; // setters and getters}[/code] Generating Report // createReport() function retrieve data from data base, fill the main report information and the detail report listReportBean report = createReport();String filename = "";byte[] result = null;try (InputStream is = new FileInputStream(filename)) { result = JasperReportsGenerator.createPDF(is, Collections.singletonList(report), params);}catch (IOException e) {}[/code] And here's the report structure: Main Report List details Report structure Thanks in advance
×
×
  • Create New...