Jasper Reports et Report design not valid : The summary section and the margins do not fit the page height

I have a big report that consists solely of a looped set of nested subreports.
Essentially it can be thought of as a list of subreports which I generate in a loop and embed in the main report vertically. The main report just a header and footer and the subreport has no header or footer.

When my loop creates about 20 or less subreports, all is fine and the main report builds. If a subreport is embedded near the end of a page then it breaks the subreport across two pages.

Hiowever, once I go above about 20 subreports I get the error

net.sf.dynamicreports.report.exception.DRException: net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :
1. The summary section and the margins do not fit the page height.

Each subreport is roughly the same vertical height, so I’m a bit confused as to why this happens. I’m quite positive there isn’t suddenly a long subreport that triggers this error.

I would expect it to keep adding more subreports and simply produce more pages.

I have tried turning on these 2 flags but this makes no difference.

reportBuild.setSummaryWithPageHeaderAndFooter(true);
reportBuild.setTitleOnANewPage(true);

Any ideas?

I have managed to solve this issue and am posting it here for others. I followed this question
[/questions/16670097/creating-a-dynamic-report-without-data-source-and-putting-data-in-detail-band-al]

Basically, you need to create an empty data source for the detail section and then add all the subreports to a multipage list builder, add the multilist to the detail section and then build the main report and export to pdf, by doing this

        JasperReportBuilder reportBuild = DynamicReports.report();
        reportBuild.setPageFormat(PageType.A4, PageOrientation.PORTRAIT);
        MultiPageListBuilder multipage = cmp.multiPageList();
        reportBuild.setDataSource(new net.sf.jasperreports.engine.JREmptyDataSource());

            String sWONo = rsltset.getString("WEDNo");
            String sPWPNo = rsltset.getString("PWPNo");
            String sPMANo = rsltset.getString("PMANo");
            subReports[i] = cmp.subreport(getImageSubReport(sWONo, sPWPNo,sPMANo)); 
            subReports2[i] = cmp.subreport(getCommonSubReport(sWONo, sPWPNo,sPMANo));
              multipage.add(cmp.verticalList(subReportBody2));
              multipage.add(cmp.verticalList(subReports2[i]));
              multipage.add(cmp.verticalGap(20));
              multipage.add(subReports[i]);
              multipage.add(cmp.verticalGap(20));
        }
        
        reportBuild.addDetail(multipage);
        reportBuild.summaryWithPageHeaderAndFooter();
        reportBuild.toPdf(export.pdfExporter(sRandomFile));

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật