public ScreenModel.Show handleRequest(Database db, MolgenisRequest request, OutputStream xlsDownload)
throws ParseException, DatabaseException, Exception
{
FormModel<?> view = this.getFormScreen();
List<String> fieldsToExport = ((FormController<?>) this.getController()).getVisibleColumnNames();
ExcelWriter excelWriter = new ExcelWriter(xlsDownload);
TupleWriter sheetWriter = excelWriter.createTupleWriter("Entity");
try
{
sheetWriter.writeColNames(fieldsToExport);
for (Entity e : view.getRecords())
sheetWriter.write(new EntityTuple(e));
}
finally
{
excelWriter.close();
}
return ScreenModel.Show.SHOW_MAIN;
}