use of org.activityinfo.io.xls.XlsTableWriter in project activityinfo by bedatadriven.
the class ExportFormExecutor method execute.
@Override
public ExportResult execute(ExportFormJob descriptor) throws IOException {
TableModel tableModel = descriptor.getTableModel();
GeneratedResource export = storageProvider.create(XlsTableWriter.EXCEL_MIME_TYPE, "Export.xls");
TableViewModel viewModel = new TableViewModel(formSource, tableModel);
EffectiveTableModel effectiveTableModel = viewModel.getEffectiveTable().waitFor();
ColumnSet columnSet = effectiveTableModel.getColumnSet().waitFor();
XlsTableWriter writer = new XlsTableWriter();
writer.addSheet(effectiveTableModel, columnSet);
try (OutputStream out = export.openOutputStream()) {
writer.write(out);
}
return new ExportResult(export.getDownloadUri());
}
Aggregations