use of org.olat.core.util.openxml.OpenXMLWorksheet in project OpenOLAT by OpenOLAT.
the class QuestionItemAuditLogExport method generate.
@Override
protected void generate(OutputStream out) {
Collections.sort(auditLog, new QuestionItemAuditLogComparator());
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
addSheetSettings(exportSheet);
addHeader(exportSheet);
addContent(exportSheet, workbook);
} catch (IOException e) {
log.error("", e);
} catch (Exception e) {
log.error("", e);
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet in project OpenOLAT by OpenOLAT.
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);
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet in project OpenOLAT by OpenOLAT.
the class LecturesBlocksEntryExport method generate.
@Override
protected void generate(OutputStream out) {
blocks = lectureService.getLectureBlocksWithTeachers(entry);
Collections.sort(blocks, new LectureBlockWithTeachersComparator());
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1 + blocks.size())) {
// overview of all lecture blocks
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
exportSheet.setHeaderRows(1);
addHeaders(exportSheet);
addContent(exportSheet);
for (LectureBlockWithTeachers block : blocks) {
OpenXMLWorksheet exportBlockSheet = workbook.nextWorksheet();
LectureBlockExport lectureBlockExport = new LectureBlockExport(block.getLectureBlock(), block.getTeachers(), isAdministrativeUser, authorizedAbsenceEnabled, translator);
lectureBlockExport.generate(exportBlockSheet);
}
} catch (IOException e) {
log.error("", e);
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet in project OpenOLAT by OpenOLAT.
the class CustomDBController method exportDb.
private void exportDb(UserRequest ureq, final String category) {
final ICourse course = CourseFactory.loadCourse(courseKey);
String label = ExportUtil.createFileNameWithTimeStamp("DBS_" + course.getCourseTitle(), "xls");
MediaResource export = new OpenXMLWorkbookResource(label) {
@Override
protected void generate(OutputStream out) {
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
List<CourseDBEntry> content = courseDbManager.getValues(course, null, category, null);
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
// create the headers
Row headerRow = exportSheet.newRow();
headerRow.addCell(0, translate("customDb.category"), workbook.getStyles().getHeaderStyle());
headerRow.addCell(1, translate("customDb.entry.identity"), workbook.getStyles().getHeaderStyle());
headerRow.addCell(2, translate("customDb.entry.name"), workbook.getStyles().getHeaderStyle());
headerRow.addCell(3, translate("customDb.entry.value"), workbook.getStyles().getHeaderStyle());
for (CourseDBEntry entry : content) {
User user = entry.getIdentity().getUser();
String name = user.getProperty(UserConstants.FIRSTNAME, null) + " " + user.getProperty(UserConstants.LASTNAME, null);
Row dataRow = exportSheet.newRow();
dataRow.addCell(0, entry.getCategory(), null);
dataRow.addCell(1, name, null);
if (StringHelper.containsNonWhitespace(entry.getName())) {
dataRow.addCell(2, entry.getName(), null);
}
if (entry.getValue() != null) {
dataRow.addCell(3, entry.getValue().toString(), null);
}
}
} catch (IOException e) {
logError("", e);
}
}
};
ureq.getDispatchResult().setResultingMediaResource(export);
}
use of org.olat.core.util.openxml.OpenXMLWorksheet in project openolat by klemens.
the class CustomDBController method exportDb.
private void exportDb(UserRequest ureq, final String category) {
final ICourse course = CourseFactory.loadCourse(courseKey);
String label = ExportUtil.createFileNameWithTimeStamp("DBS_" + course.getCourseTitle(), "xls");
MediaResource export = new OpenXMLWorkbookResource(label) {
@Override
protected void generate(OutputStream out) {
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
List<CourseDBEntry> content = courseDbManager.getValues(course, null, category, null);
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
// create the headers
Row headerRow = exportSheet.newRow();
headerRow.addCell(0, translate("customDb.category"), workbook.getStyles().getHeaderStyle());
headerRow.addCell(1, translate("customDb.entry.identity"), workbook.getStyles().getHeaderStyle());
headerRow.addCell(2, translate("customDb.entry.name"), workbook.getStyles().getHeaderStyle());
headerRow.addCell(3, translate("customDb.entry.value"), workbook.getStyles().getHeaderStyle());
for (CourseDBEntry entry : content) {
User user = entry.getIdentity().getUser();
String name = user.getProperty(UserConstants.FIRSTNAME, null) + " " + user.getProperty(UserConstants.LASTNAME, null);
Row dataRow = exportSheet.newRow();
dataRow.addCell(0, entry.getCategory(), null);
dataRow.addCell(1, name, null);
if (StringHelper.containsNonWhitespace(entry.getName())) {
dataRow.addCell(2, entry.getName(), null);
}
if (entry.getValue() != null) {
dataRow.addCell(3, entry.getValue().toString(), null);
}
}
} catch (IOException e) {
logError("", e);
}
}
};
ureq.getDispatchResult().setResultingMediaResource(export);
}
Aggregations