Grid Exporter Add-on
Extension for exporting Vaadin's grid data to common formats
This is an addon that allows to export Vaadin's grid data to some formats like Excel, Docx, PDF and CSV.
Features:
- Can configure which columns to export
- Other templates can be used besides the basic templates
- Optionally can create the export buttons automatically (default)
Sample code
GridExporter<Person> exporter = GridExporter.createFor(grid); exporter.setExportValue(c, item->""+item.getBudget()); exporter.setTitle("People information"); exporter.setFileName("GridExport" + new SimpleDateFormat("yyyyddMM").format(Calendar.getInstance().getTime())); add(grid);
GridExporter<Person> exporter = GridExporter.createFor(grid, "/custom-template.xlsx", "/custom-template.docx"); HashMap<String,String> placeholders = new HashMap<>(); placeholders.put("${date}", new SimpleDateFormat().format(Calendar.getInstance().getTime())); exporter.setExportColumn(nameColumn, false); exporter.setExportColumn(lastNameColumn, true); exporter.setAdditionalPlaceHolders(placeholders); exporter.setSheetNumber(1); exporter.setCsvExportEnabled(false); exporter.setTitle("People information"); exporter.setFileName("GridExport" + new SimpleDateFormat("yyyyddMM").format(Calendar.getInstance().getTime())); add(grid);
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Bug fixes:
- Released
- 2023-02-06
- Maturity
- TESTED
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 23
- Vaadin 24
- Browser
- Firefox
- Safari
- Google Chrome
- iOS Browser
- Android Browser
- Microsoft Edge