use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class QTI21ArchiveFormat method writeHeaders_2.
private void writeHeaders_2(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
CellStyle headerStyle = workbook.getStyles().getHeaderStyle();
// second header
// reset column counter
int col = 0;
Row header2Row = exportSheet.newRow();
String sequentialNumber = translator.translate("column.header.seqnum");
header2Row.addCell(col++, sequentialNumber, headerStyle);
if (anonymizerCallback != null) {
col++;
} else {
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null) {
continue;
}
String header = translator.translate(userPropertyHandler.i18nFormElementLabelKey());
header2Row.addCell(col++, header, headerStyle);
}
// add other user and session information
header2Row.addCell(col++, translator.translate("column.header.homepage"), headerStyle);
}
// course node points and passed
if (courseNode instanceof AssessableCourseNode) {
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
if (assessableCourseNode.hasScoreConfigured()) {
header2Row.addCell(col++, translator.translate("archive.table.header.node.points"), headerStyle);
}
if (assessableCourseNode.hasPassedConfigured()) {
header2Row.addCell(col++, translator.translate("archive.table.header.node.passed"), headerStyle);
}
}
header2Row.addCell(col++, translator.translate("archive.table.header.points"), headerStyle);
header2Row.addCell(col++, translator.translate("archive.table.header.manual.points"), headerStyle);
header2Row.addCell(col++, translator.translate("archive.table.header.final.points"), headerStyle);
header2Row.addCell(col++, translator.translate("column.header.passed"), headerStyle);
if (anonymizerCallback == null) {
header2Row.addCell(col++, translator.translate("column.header.date"), headerStyle);
}
header2Row.addCell(col++, translator.translate("column.header.duration"), headerStyle);
List<AbstractInfos> infos = getItemInfos();
for (int i = 0; i < infos.size(); i++) {
AbstractInfos info = infos.get(i);
if (info instanceof ItemInfos) {
ItemInfos item = (ItemInfos) info;
if (exportConfig.isResponseCols()) {
List<Interaction> interactions = item.getInteractions();
for (int j = 0; j < interactions.size(); j++) {
Interaction interaction = interactions.get(j);
col = interactionArchiveMap.get(interaction.getQtiClassName()).writeHeader2(item.getAssessmentItem(), interaction, i, j, header2Row, col, workbook);
}
}
if (exportConfig.isPointCol()) {
header2Row.addCell(col++, translator.translate("item.score"), headerStyle);
}
if (exportConfig.isCommentCol()) {
header2Row.addCell(col++, translator.translate("item.comment"), headerStyle);
}
if (exportConfig.isTimeCols()) {
if (anonymizerCallback == null) {
header2Row.addCell(col++, translator.translate("item.start"), headerStyle);
}
header2Row.addCell(col++, translator.translate("item.duration"), headerStyle);
}
} else if (numOfSections > 1 && info instanceof SectionInfos) {
SectionInfos section = (SectionInfos) info;
if (!section.getItemInfos().isEmpty()) {
header2Row.addCell(col++, translator.translate("archive.table.header.points"), headerStyle);
}
}
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class OpenXmlWorkbookTest method creationOfWorkbook.
/**
* Sadly, I can only test if our system produce a non empty file.
* @throws IOException
*/
@Test
public void creationOfWorkbook() throws IOException {
File file = File.createTempFile("workbook", "_min.xlsx");
FileOutputStream fileOut = new FileOutputStream(file);
OpenXMLWorkbook workbook = new OpenXMLWorkbook(fileOut, 1);
OpenXMLWorksheet sheet = workbook.nextWorksheet();
sheet.setHeaderRows(1);
// 0 empty
sheet.newRow();
Row row1 = sheet.newRow();
row1.addCell(1, "Title", null);
row1.addCell(2, "Titre", null);
row1.addCell(1, 1.0d, null);
Row row2 = sheet.newRow();
row2.addCell(2, "Hello", null);
row2.addCell(2, "Border", workbook.getStyles().getBorderRightStyle());
sheet.newRow();
Row row4 = sheet.newRow();
row4.addCell(5, new Date(), workbook.getStyles().getDateStyle());
workbook.close();
fileOut.flush();
IOUtils.closeQuietly(fileOut);
Assert.assertTrue(file.exists());
Assert.assertTrue(file.length() > 4096);
file.delete();
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class LecturesStatisticsExport method addContentAggregated.
private void addContentAggregated(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
List<LectureBlockIdentityStatistics> aggregatedStatistics = lectureService.groupByIdentity(statistics);
for (LectureBlockIdentityStatistics statistic : aggregatedStatistics) {
Row row = exportSheet.newRow();
int pos = 0;
pos = addContentUser(statistic, row, pos);
addContentStatistics(statistic, row, pos, workbook);
}
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class LecturesStatisticsExport method addHeadersDetailled.
private void addHeadersDetailled(OpenXMLWorksheet exportSheet) {
Row headerRow = exportSheet.newRow();
int pos = 0;
pos = addHeadersUser(headerRow, pos);
headerRow.addCell(pos++, translator.translate("table.header.external.ref"));
headerRow.addCell(pos++, translator.translate("table.header.entry"));
addHeadersStatistics(headerRow, pos);
}
use of org.olat.core.util.openxml.OpenXMLWorksheet.Row in project OpenOLAT by OpenOLAT.
the class LecturesStatisticsExport method addContentDetailled.
private void addContentDetailled(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
for (LectureBlockIdentityStatistics statistic : statistics) {
Row row = exportSheet.newRow();
int pos = 0;
pos = addContentUser(statistic, row, pos);
row.addCell(pos++, statistic.getExternalRef());
row.addCell(pos++, statistic.getDisplayName());
addContentStatistics(statistic, row, pos, workbook);
}
}
Aggregations