Vaadin 8: Export Grid content to Excel

I want to export the content of a Grid in an Excel file.
The Excel should contain all cell data of the Grid like a 1:1 copy of the ‘visible’ information (taking into account the Filters, SortOrder and column hiding).
The DataProvider could give me the filtered Beans to export. But were can I get informations about the Column values and rendering? There seems to be no way to get the ValueProviders of the Columns and there are no Items and Properties any more.
Any ideas?

Have you tried using the Table export addon? https://vaadin.com/directory#!addon/tableexport

You can also use it with grids by making a TableHolder from the Grid:

exportButton = new Button("Export");
exportButton.addClickListener(e -> {
    TableHolder tableHolder = new DefaultTableHolder(grid);
    ExcelExport excelExport = new ExcelExport(tableHolder);
    excelExport.excludeCollapsedColumns();
    excelExport.setDisplayTotals(false);
    excelExport.export();
});

Thany for the answer, but TableExport does not support Vaadin 8.
It is based on Containers and there are no Containers in Vaadin 8 any more.

Don’t have time right now to update the add-on to Vaadin 8 but the source is available at https://github.com/jnash67/tableexport-for-vaadin/.

If you want to contribute to a Vaadin 8 version, let me know and I’ll add you to the project.

Hello Johnatan
I’ve did the Vaadin 8 migration of tableexport plugin some months ago, there’s a pull request there.
We use the custom build from that branch, but I assume other users would welcome public release of it.
Would you check the pull request please, or if you don’t have time to support the plugin anymore, could you add me to the project ?

“Other users would welcome public release of it.” Vote up for that!!! :slight_smile:

Martin - Sorry for late reply. Would be happy to add you to the project. Let me know what email address to add. Email me at jnash67@yahoo.com.

Alexander Ley:
I want to export the content of a Grid in an Excel file.
The Excel should contain all cell data of the Grid like a 1:1 copy of the ‘visible’ information (taking into account the Filters, SortOrder and column hiding).
The DataProvider could give me the filtered Beans to export. But were can I get informations about the Column values and rendering? There seems to be no way to get the ValueProviders of the Columns and there are no Items and Properties any more.
Any ideas?

Did you find the solution to your problem?
I had a project in vaadin 7 and I passed it to 8 now I have this same question

I create an Excel file from the data from the Grid DataProvider with Apache poi.

There is add-on for Excel Export, which is build on top of Apache POI https://vaadin.com/directory/component/excel-exporter

With some improvements, you can make it work with lazy data providers and tree grid as well

See also the discussion here: https://vaadin.com/forum/thread/16971210

I’m using the latest version of tableexport-for-vaadin for Vaadin 8 from GitHub and I’m getting this error:

Cannot add merged region A1:K1 to sheet because it overlaps with an existing merged region (A1:K1).

I’ve used the addon before for Vaadin 7 with no issues.
Anyone else experience this or any idea what may be causing this?

    ExcelExport export = new ExcelExport(dataGrid, "Authorised Items", "Authorised Items", "Authorised Items.xls", false);
    export.setDisplayTotals(false);
    export.setDoubleDataFormat("#,###.##");
    export.setDateDataFormat("dd-MM-yyyy hh:mm:ss AM/PM");
    export.setExcelFormatOfProperty("ean", "0000000000000");
    export.convertTable();
    export.export();

Hi, I’m using the PagedDataProvider for Grid to display more than 1 lakh data. Now I need to export the grid content to excel but when I export I’m getting only the current page data to excel sheet and every time I need to change the page number to export particular page data. Is there any option to export all the pages data at once?Please help.

Good morning. Is the vaadin-gird export excel and cls working with Polymer 3.0?