I created a report with dynamic columns using dynamic reports. If any column in the last row is overflows then the only the overflowing column is stretched and printed on next page. Rest of the columns is not stretched.
The printed report is look like this:
Following section of code is used for creating report with dynamic columns.
JasperReportBuilder jasperReportBuilder=DynamicReports.report();
for(Field field:fields){
for (Entry<String, String> entry : dynamicTableColumns.entrySet()) {
if ( entry.getKey().equals(field.getName())){
jasperReportBuilder.columns(DynamicReports.col.column(entry.getValue(), field.getName().toString(), DynamicReports.type.stringType()).setStretchWithOverflow(true));
}
}
}
I haven't seen any option to set the column's stretch type as RELATIVE_TO_TALLEST_OBJECT. Is there any other way to fix this ?
Setting detail's split type as 'PREVENT' will prevent the row from stretching to next page and move the entire row to next page.
jasperReportBuilder.setDetailSplitType(SplitType.PREVENT);