Java Code Examples for net.sf.jasperreports.engine.JasperReport#setWhenNoDataType()

The following examples show how to use net.sf.jasperreports.engine.JasperReport#setWhenNoDataType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TravelReportFactoryServiceImpl.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Create a subreport for the specified field. {@link Field} instance must have {@link SubReport} annotation
 *
 * @return JasperReport as a subreport
 */
@Override
public JasperReport processReportForField(final ReportInfo report, final Field field) throws Exception {
    final JasperDesign design = designReport(report, field);
    if (design == null) {
        return null;
    }

    final JasperReport retval = JasperCompileManager.compileReport(design);
    retval.setWhenNoDataType(JasperReport.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL);

    return retval;
}
 
Example 2
Source File: JasperReportsUtil.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public static JasperReport getJasper(String file) throws JRException {
    	 // Jasper 5.1.0+
        JasperReport jr = (JasperReport) JRLoader.loadObjectFromFile(file);
        // default is WHEN_NO_DATA_TYPE_BLANK_PAGE
        // we want to show something even no data found
        jr.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
        return jr;
    	
//    	JasperReport jr = (JasperReport) JRLoader.loadObject(file);
//        // default is WHEN_NO_DATA_TYPE_BLANK_PAGE
//        // we want to show something even no data found
//        jr.setWhenNoDataType(JasperReport.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL);
//        return jr;
    }