Search code examples
javavaadinvaadin7

Vaadin TableExport addon does not handle Label component directly


In my table I have a column defined as follows:

table.addContainerProperty("Skill", Label.class, null);

When I export this table using TableExport addon

 Button excelExportButton = new Button("Export to Excel", click -> {
        ExcelExport excelExport;
        excelExport = new ExcelExport(table);
        excelExport.setReportTitle("Foo Bar");
        excelExport.setDisplayTotals(false);
        excelExport.export();
    });

I get com.vaadin.ui.Label@6a3f610e instead of text. How can I fix this?

Thank you in advance for help.


Solution

  • I have never used the TableExport addon but I have two solutions in my mind:

    1. Use String as a property type: table.addContainerProperty("Skill", String.class, null);

    2. Create your own extended Label and override the toString() method to return the value you want to see in exported excel sheets.