use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class ChatLogHelper method logMediaResource.
public MediaResource logMediaResource(OLATResourceable ores, Locale locale) {
Translator translator = Util.createPackageTranslator(ChatController.class, locale);
String tableExportTitle = translator.translate("logChat.export.title");
String label = tableExportTitle + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".xlsx";
return new OpenXMLWorkbookResource(label) {
@Override
protected void generate(OutputStream out) {
try (OpenXMLWorkbook workbook = new OpenXMLWorkbook(out, 1)) {
// headers
OpenXMLWorksheet exportSheet = workbook.nextWorksheet();
Row headerRow = exportSheet.newRow();
headerRow.addCell(0, "User", workbook.getStyles().getHeaderStyle());
headerRow.addCell(1, "Date", workbook.getStyles().getHeaderStyle());
headerRow.addCell(2, "Content", workbook.getStyles().getHeaderStyle());
// content
List<InstantMessage> messages = imDao.getMessages(ores, null, 0, -1);
for (InstantMessage message : messages) {
Row dataRow = exportSheet.newRow();
dataRow.addCell(0, message.getFromNickName(), null);
dataRow.addCell(1, message.getCreationDate(), workbook.getStyles().getDateStyle());
dataRow.addCell(2, message.getBody(), null);
}
} catch (IOException e) {
log.error("", e);
}
}
};
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class XlsMembersExport method createData.
private void createData(Map<Identity, StringBuilder> members, List<Identity> rows, List<UserPropertyHandler> userPropertyHandlers, OpenXMLWorksheet sheet) {
sheet.setHeaderRows(1);
for (int r = 0; r < rows.size(); r++) {
Row dataRow = sheet.newRow();
for (int c = 0; c < userPropertyHandlers.size(); c++) {
String value = userPropertyHandlers.get(c).getUserProperty(rows.get(r).getUser(), null);
dataRow.addCell(c, value, null);
}
dataRow.addCell(userPropertyHandlers.size(), members.get(rows.get(r)).toString());
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class IdentityAuditLogExport method addHeaders.
@Override
protected void addHeaders(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
headerRow.addCell(pos++, userManager.getUserDisplayName(identity));
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class LectureBlockAuditLogExport method addHeaders.
@Override
protected void addHeaders(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
headerRow.addCell(pos++, translator.translate("export.header.entry", new String[] { entry.getDisplayname() }));
Formatter formatter = Formatter.getInstance(translator.getLocale());
String[] args = new String[] { lectureBlock.getTitle(), formatter.formatDate(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getStartDate()), formatter.formatTimeShort(lectureBlock.getEndDate()) };
headerRow.addCell(pos++, translator.translate("export.header.lectureblocks", args));
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class LecturesBlocksEntryExport method addHeaders.
private void addHeaders(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
headerRow.addCell(pos++, translator.translate("lecture.title", null));
headerRow.addCell(pos++, translator.translate("lecture.location", null));
headerRow.addCell(pos++, translator.translate("lecture.date", null));
headerRow.addCell(pos++, translator.translate("table.header.start.time", null));
headerRow.addCell(pos++, translator.translate("table.header.end.time", null));
headerRow.addCell(pos++, translator.translate("table.header.teachers", null));
headerRow.addCell(pos++, translator.translate("table.header.status", null));
headerRow.addCell(pos++, translator.translate("table.header.auto.close.date", null));
headerRow.addCell(pos++, translator.translate("planned.lectures", null));
headerRow.addCell(pos++, translator.translate("table.header.effective.lectures", null));
headerRow.addCell(pos++, translator.translate("lecture.block.effective.end", null));
headerRow.addCell(pos++, translator.translate("lecture.block.effective.reason", null));
headerRow.addCell(pos++, translator.translate("table.header.comment", null));
}
Aggregations