Directory

← Back

Grid Exporter Add-on

Extension for exporting Vaadin's grid data to common formats

Author

Rating

Popularity

1700+

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);

Compatibility

(Loading compatibility data...)

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:

  • use Vaadin 24 API (#51)
  • upgrade grid-helpers to 1.1.1 (#67)
  • remove use of reflection
  • add missing parameter to query (#70)
Released
2023-07-11
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 24
Vaadin 24.3 in 2.3.2
Vaadin 23 in 1.9.1
Browser
N/A

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
The channel for finding, promoting, and distributing Vaadin add-ons.
Online