我是 Vaadin 的新手。此时我遇到问题 ExcelExport。
当我单击按钮时,它没有下载文件,也没有显示任何错误。
我不知道这个文件的位置是什么。
final ThemeResource export = new ThemeResource("adminicons/green.png");
final Button excelExportButton = new Button("Export to Excel");
public TestExport() {
final Table table = new Table("This is my Table");
HorizontalLayout vlaLayout = new HorizontalLayout();
table.addContainerProperty("First Name", String.class, null);
table.addContainerProperty("Last Name", String.class, null);
table.addContainerProperty("Year", Integer.class, null);
table.addItem(new Object[] {
"Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
table.addItem(new Object[] {
"Tycho", "Brahe", new Integer(1546)}, new Integer(2));
table.addItem(new Object[] {
"Giordano","Bruno", new Integer(1548)}, new Integer(3));
table.addItem(new Object[] {
"Galileo", "Galilei", new Integer(1564)}, new Integer(4));
table.addItem(new Object[] {
"Johannes","Kepler", new Integer(1571)}, new Integer(5));
table.addItem(new Object[] {
"Isaac", "Newton", new Integer(1643)}, new Integer(6));
excelExportButton.setIcon(export);
excelExportButton.addListener(new ClickListener() {
private static final long serialVersionUID = -73954695086117200L;
private ExcelExport excelExport;
public void buttonClick(final ClickEvent event) {
excelExport = new ExcelExport(table);
excelExport.excludeCollapsedColumns();
excelExport.setReportTitle("Demo Report");
excelExport.export();
}
});
vlaLayout.addComponent(table);
vlaLayout.addComponent(excelExportButton);
setCompositionRoot(vlaLayout);