Hi,I am getting some problem in TableExport.
When I’m execute ExcelExport in ‘IE’. file download normally completed. But application display is not work. it seems like freeze… other browsers except ‘IE’ works normally.
Please help me.
Here is my source Code, but nothing special.
This project use ‘VAADIN 6.8.2’, ‘tableexport 1.3.0’. ‘poi-3.8-20120326’, test browser is ‘IE9’.
package com.example.tableexporttest;
import com.vaadin.Application;
import com.vaadin.addon.tableexport.ExcelExport;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;
public class TableExportTestApplication extends Application {
private static final long serialVersionUID = -358401159901798795L;
public static final String BUTTON_CAPTION = "Excel Download";
public static final String BUTTON_REPORT_NAME = "Demo Export";
public static final String TABLE_INDEX_ID = "Index";
public static final String TABLE_CONTENTS_ID = "Contents";
public static final String TABLE_CONTENTS_DATA_PREFIX = "Contents...";
@Override
public void init() {
Window mainWindow = new Window("Tableexporttest Application");
Label label = new Label("Hello Vaadin user");
final Table tempTable = new Table();
tempTable.setSelectable(true);
tempTable.setContainerDataSource(this.getTableData());
Button excelButton = new Button(TableExportTestApplication.BUTTON_CAPTION, new ClickListener() {
private static final long serialVersionUID = -1757993712608633830L;
public void buttonClick(ClickEvent event) {
ExcelExport excelExport = new ExcelExport(tempTable);
excelExport.excludeCollapsedColumns();
excelExport.setReportTitle(TableExportTestApplication.BUTTON_REPORT_NAME);
excelExport.export();
}
});
mainWindow.addComponent(label);
mainWindow.addComponent(tempTable);
mainWindow.addComponent(excelButton);
setMainWindow(mainWindow);
}
private Container getTableData() {
Container tableData = new IndexedContainer();
tableData.addContainerProperty(TableExportTestApplication.TABLE_INDEX_ID, Integer.class, 0);
tableData.addContainerProperty(TableExportTestApplication.TABLE_CONTENTS_ID, String.class, "");
for(int i = 0 ; i < 10 ; i++) {
Item item = tableData.addItem(i);
item.getItemProperty(TableExportTestApplication.TABLE_INDEX_ID).setValue(i);
item.getItemProperty(TableExportTestApplication.TABLE_CONTENTS_ID).setValue(TableExportTestApplication.TABLE_CONTENTS_DATA_PREFIX);
}
return tableData;
}
}