subreportParameter.setExpression(expression2);
try {
subreport.addParameter(subreportParameter );
} catch (JRException e) {
log.error("Error registering parameter for subreport, there must be another parameter with the same name");
throw new CoreException(e.getMessage(),e);
}
}
//some other options (cosmetic)
//subreport.setStretchType(JRDesignElement.STRETCH_TYPE_NO_STRETCH);