use of com.haulmont.cuba.gui.export.ExcelExporter.ExportMode in project cuba by cuba-platform.
the class ExcelAction method export.
/**
* Export via {@link ExcelExporter}.
*/
protected void export(ExportMode exportMode) {
ExcelExporter exporter = new ExcelExporter(exportFormat);
exporter.setExportAggregation(exportAggregation);
if (listComponent instanceof Table) {
Table<Entity> table = (Table<Entity>) listComponent;
exporter.exportTable(table, table.getNotCollapsedColumns(), false, display, null, fileName, exportMode);
}
if (listComponent instanceof DataGrid) {
DataGrid<Entity> dataGrid = (DataGrid<Entity>) listComponent;
List<DataGrid.Column> columns = dataGrid.getVisibleColumns().stream().filter(col -> !col.isCollapsed()).collect(Collectors.toList());
exporter.exportDataGrid(dataGrid, columns, display, null, fileName, exportMode);
}
if (exporter.isXlsMaxRowNumberExceeded()) {
Notifications notifications = getScreenContext(listComponent).getNotifications();
notifications.create(NotificationType.WARNING).withCaption(messages.getMainMessage("actions.warningExport.title")).withDescription(messages.getMainMessage("actions.warningExport.message")).show();
}
}
Aggregations