The Vaadin Grid Exporter can convert nearly any Vaadin Grid to a variety of formats.
This way you don't have to copy the Grid contents manually or print the whole website with the Grid.
Out of the box supported formats:
- CSV
- Word (DOCX)
- HTML
- ODS
- ODT
- PowerPoint (PPTX)
- RTF
- Plain text
- Excel (XLSX)
These formats are exported using dynamicreports.
It's also easy to extend the Exporter to support your custom format.
Note
Disclaimer about the scope of this component (click to expand)
Although the GridExporter can handle most use-cases, extreme scenarios will likely impact performance, usability and might require some hacks.
For such cases custom written exports are recommended e.g. by utilizing JasperReports directly.
If you need help implementing these feel free to contact us or open a question if you are not sure that the GridExporter is a good option for your scenario.
Default usage:
GridExporter
.newWithDefaults(this.grExamples)
.open();
Custom format (see JsonGridExporterProvider from Demo):
GridExporter
.newWithDefaults(this.grExamples)
.loadFromProvider(new JsonGridExporterProvider())
.open();
Installation guide for the latest release
Tip
In Spring Security the default value of X-Frame-Options
is DENY
which will break the preview if not changed.
To show the preview the CSP or the X-Frame-Options (deprecated in favor of CSP) must be configured in a way that they allow showing same-site elements.
This can be achieved by:
- setting the CSP to include at least
frame-ancestors 'self'
and maybe additionallyobject-src 'self'
- setting
X-Frame-Options
toSAMESITE
.
If you use Spring Security without a CSP the easiest way to set this is:http.headers(c -> c.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin));
Note
Depending on the browser the settings sometimes have slightly different effects.
For example Firefox blocks the preview due to privacy reasons when X-Frame-Option=DENY
and Content-Security-Policy=frame-ancestors 'self'; object-src 'self'; ...
but Chrome does not.
Vaadin version | GridExporter version |
---|---|
Vaadin 24+ (latest) | 3+ |
Vaadin 23 | 2.x |
Starting with version 3.1.0 JasperReports 7 is required.
- Checkout the repo
- Run
mvn install && mvn -f vaadin-grid-exporter-demo spring-boot:run
- Open http://localhost:8080
If you need support as soon as possible and you can't wait for any pull request, feel free to use our support.
See the contributing guide for detailed instructions on how to get started with our project.
View the license of the current project or the summary including all dependencies