Search in sources :

Example 21 with OpenXMLWorkbook

use of org.olat.core.util.openxml.OpenXMLWorkbook in project OpenOLAT by OpenOLAT.

the class AbstractLectureBlockAuditLogExport method generate.

@Override
protected void generate(OutputStream out) {
    Collections.sort(auditLog, new LectureBlockAuditLogComparator());
    try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
        OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
        addSheetSettings(exportSheet);
        addHeaders(exportSheet);
        addHeader(exportSheet);
        addContent(exportSheet, workbook);
    } catch (IOException e) {
        log.error("", e);
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) IOException(java.io.IOException)

Example 22 with OpenXMLWorkbook

use of org.olat.core.util.openxml.OpenXMLWorkbook in project OpenOLAT by OpenOLAT.

the class LecturesStatisticsExport method generate.

@Override
protected void generate(OutputStream out) {
    try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 2)) {
        OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
        exportSheet.setHeaderRows(1);
        addHeadersAggregated(exportSheet);
        addContentAggregated(exportSheet, workbook);
        exportSheet = workbook.nextWorksheet();
        exportSheet.setHeaderRows(1);
        addHeadersDetailled(exportSheet);
        addContentDetailled(exportSheet, workbook);
    } catch (IOException e) {
        log.error("", e);
    }
}
Also used : OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet)

Example 23 with OpenXMLWorkbook

use of org.olat.core.util.openxml.OpenXMLWorkbook in project openolat by klemens.

the class XlsFlexiTableExporter method export.

@Override
public MediaResource export(FlexiTableComponent ftC, List<FlexiColumnModel> columns, Translator translator) {
    String label = "TableExport_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".xlsx";
    return new OpenXMLWorkbookResource(label) {

        @Override
        protected void generate(OutputStream out) {
            try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
                OpenXMLWorksheet sheet = workbook.nextWorksheet();
                createHeader(columns, translator, sheet, workbook);
                createData(ftC, columns, translator, sheet, workbook);
            } catch (IOException e) {
                log.error("", e);
            }
        }
    };
}
Also used : OpenXMLWorkbookResource(org.olat.core.util.openxml.OpenXMLWorkbookResource) OutputStream(java.io.OutputStream) OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) Date(java.util.Date)

Example 24 with OpenXMLWorkbook

use of org.olat.core.util.openxml.OpenXMLWorkbook in project openolat by klemens.

the class CheckListExcelExport method exportWorkbook.

public void exportWorkbook(List<AssessmentData> dataList, OutputStream exportStream) {
    try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(exportStream, 1)) {
        // headers
        OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
        exportSheet.setHeaderRows(1);
        writeHeaders(exportSheet, workbook);
        writeData(dataList, exportSheet);
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) IOException(java.io.IOException)

Example 25 with OpenXMLWorkbook

use of org.olat.core.util.openxml.OpenXMLWorkbook in project openolat by klemens.

the class DefaultXlsTableExporter method export.

/**
 * @see org.olat.core.gui.components.table.TableExporter#export(org.olat.core.gui.components.table.Table)
 */
@Override
public MediaResource export(final Table table) {
    Translator translator = table.getTranslator();
    int cdcnt = table.getColumnCount();
    int rcnt = table.getRowCount();
    String label = "TableExport_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".xlsx";
    return new OpenXMLWorkbookResource(label) {

        @Override
        protected void generate(OutputStream out) {
            try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
                OpenXMLWorksheet sheet = workbook.nextWorksheet();
                createHeader(table, translator, cdcnt, sheet, workbook);
                createData(table, cdcnt, rcnt, sheet);
            } catch (IOException e) {
                log.error("", e);
            }
        }
    };
}
Also used : Translator(org.olat.core.gui.translator.Translator) OpenXMLWorkbookResource(org.olat.core.util.openxml.OpenXMLWorkbookResource) OutputStream(java.io.OutputStream) OpenXMLWorkbook(org.olat.core.util.openxml.OpenXMLWorkbook) IOException(java.io.IOException) OpenXMLWorksheet(org.olat.core.util.openxml.OpenXMLWorksheet) Date(java.util.Date)

Aggregations

IOException (java.io.IOException)28 OpenXMLWorkbook (org.olat.core.util.openxml.OpenXMLWorkbook)28 OpenXMLWorksheet (org.olat.core.util.openxml.OpenXMLWorksheet)28 OutputStream (java.io.OutputStream)12 Date (java.util.Date)12 OpenXMLWorkbookResource (org.olat.core.util.openxml.OpenXMLWorkbookResource)12 Translator (org.olat.core.gui.translator.Translator)6 Row (org.olat.core.util.openxml.OpenXMLWorksheet.Row)6 File (java.io.File)4 ICourse (org.olat.course.ICourse)4 FileResourceManager (org.olat.fileresource.FileResourceManager)4 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)4 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)4 ObjectOutputStream (java.io.ObjectOutputStream)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ZipOutputStream (java.util.zip.ZipOutputStream)2 MediaResource (org.olat.core.gui.media.MediaResource)2 Identity (org.olat.core.id.Identity)2 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)2