Vaadin TableExport 插件不直接处理 Label 组件
Vaadin TableExport addon does not handle Label component directly
在我的 table 中,我有一列定义如下:
table.addContainerProperty("Skill", Label.class, null);
当我使用 TableExport 插件导出此 table 时
Button excelExportButton = new Button("Export to Excel", click -> {
ExcelExport excelExport;
excelExport = new ExcelExport(table);
excelExport.setReportTitle("Foo Bar");
excelExport.setDisplayTotals(false);
excelExport.export();
});
我收到 com.vaadin.ui.Label@6a3f610e
而不是文本。我该如何解决这个问题?
提前感谢您的帮助。
我从未使用过 TableExport 插件,但我有两个解决方案:
将String
用作属性类型:table.addContainerProperty("Skill", String.class, null);
创建您自己的扩展 Label
并将 toString()
方法覆盖为 return 您希望在导出的 excel 工作表中看到的值。
在我的 table 中,我有一列定义如下:
table.addContainerProperty("Skill", Label.class, null);
当我使用 TableExport 插件导出此 table 时
Button excelExportButton = new Button("Export to Excel", click -> {
ExcelExport excelExport;
excelExport = new ExcelExport(table);
excelExport.setReportTitle("Foo Bar");
excelExport.setDisplayTotals(false);
excelExport.export();
});
我收到 com.vaadin.ui.Label@6a3f610e
而不是文本。我该如何解决这个问题?
提前感谢您的帮助。
我从未使用过 TableExport 插件,但我有两个解决方案:
将
String
用作属性类型:table.addContainerProperty("Skill", String.class, null);
创建您自己的扩展
Label
并将toString()
方法覆盖为 return 您希望在导出的 excel 工作表中看到的值。