subReport.setReportHeader((ReportHeader) masterReport.getReportHeader().derive());
subReport.setPageFooter((PageFooter) masterReport.getPageFooter().derive());
subReport.setPageHeader((PageHeader) masterReport.getPageHeader().derive());
subReport.setWatermark((Watermark) masterReport.getWatermark().derive());
subReport.setDataFactory(masterReport.getDataFactory().derive());
masterReport.copyInto(subReport);
final ReportParameterDefinition parameterDefinition = masterReport.getParameterDefinition();
for (final ParameterDefinitionEntry entry : parameterDefinition.getParameterDefinitions())
{
subReport.addInputParameter(entry.getName(), entry.getName());