I have two subreports, which are in separate worksheets. The problem is, that the column segmantation in the second worksheet is the same as in the first and so there are some merged cells. With merged cells you could not sort the columns ("This operation requires the merged cells to be identically sized").
How could I enforce a new style/segmentation of the columns?
These are my settings for the exporter:
reportBuilder.title(cmp.subreport(criteriaReportBuilder), cmp.subreport(secondReportBuilder));
JasperXlsxExporterBuilder xlsxExporter = DynamicReports.export.xlsxExporter(outputStream);
xlsxExporter.setCollapseRowSpan(false);
xlsxExporter.setRemoveEmptySpaceBetweenColumns(true);
xlsxExporter.setRemoveEmptySpaceBetweenRows(false);
xlsxExporter.setDetectCellType(true);
xlsxExporter.setWhitePageBackground(false);
xlsxExporter.setIgnoreGraphics(false);
xlsxExporter.setOnePagePerSheet(false);
reportBuilder.toXlsx(xlsxExporter);
Output from second report (cmp.subreport(secondReportBuilder)) I would expect, that there are only two columns (A-B) and not A-G.
Converting comment to answer:
Generate multiple JasperPrint
from DynamicJasper
and then use the standard JRXlsExporter
JRXlsExporter exporter = new JRXlsExporter();
List<JasperPrint> sheets = new ArrayList<JasperPrint>();
sheets.add(criteriaReportBuilder.toJasperPrint());
sheets.add(reportBuilder.toJasperPrint());
exporter.setExporterInput(SimpleExporterInput.getInstance(sheets));
...