# Exporter **Repository Path**: mirrors_a-schild/Exporter ## Basic Information - **Project Name**: Exporter - **Description**: A Vaadin Add-on which exports data (in container) to an excel file - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-03-11 - **Last Updated**: 2026-03-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Exporter Allows you to export data from Grid to an Excel or CSV file ``` Exporter.exportAsExcel(grid)); Exporter.exportAsCSV(grid)) ``` A typical use case is to let user download the generated file, an Anchor component can be used for such a purpose. ``` new Anchor(new StreamResource("my-excel.xls", Exporter.exportAsExcel(grid)), "Download As Excel"); ``` ## Use instructions Each to be exported column should have a key, and the key should be a property name. A key will be generated automatically if you are also passing the class in the Grid constructor parameter, e.g. ``` Grid grid = new Grid<>(Person.class); ``` Otherwise, you need to set the key manually. e.g. ``` Grid grid = new Grid<>(); grid.addColumn(Person::getEmail).setKey("email"); ``` ### Custom column header text Create map where Column is key and header text is value. Pass that map as argument to Exporter subclass constructor. If map is null then default column key will be used for creating column header in excel. ``` private Map, String> gridHeaderMap; ... Exporter.exportAsExcel(grid, gridHeaderMap) ``` Exporter works as using reflection to read property from each item, any column without a valid key will be ignored. ## Development instructions Starting the test/demo server: ``` mvn jetty:run ``` This deploys demo at http://localhost:8080