From 966f2f3492e9e54b37d0856c6b13b247c9cbf592 Mon Sep 17 00:00:00 2001 From: Florian Gnaegi - frentix GmbH <gnaegi@frentix.com> Date: Thu, 3 Apr 2014 12:47:43 +0200 Subject: [PATCH] OO-1050 --- .../core/gui/components/table/DefaultXlsTableExporter.java | 4 +++- src/main/java/org/olat/course/db/CustomDBController.java | 4 +++- .../java/org/olat/instantMessaging/manager/ChatLogHelper.java | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/olat/core/gui/components/table/DefaultXlsTableExporter.java b/src/main/java/org/olat/core/gui/components/table/DefaultXlsTableExporter.java index 64c044f9940..dca25e41bb3 100644 --- a/src/main/java/org/olat/core/gui/components/table/DefaultXlsTableExporter.java +++ b/src/main/java/org/olat/core/gui/components/table/DefaultXlsTableExporter.java @@ -36,6 +36,7 @@ import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.WorkbookUtil; import org.olat.core.gui.media.CleanupAfterDeliveryFileMediaResource; import org.olat.core.gui.media.MediaResource; import org.olat.core.gui.render.StringOutput; @@ -71,7 +72,8 @@ public class DefaultXlsTableExporter implements TableExporter { headerCellStyle = getHeaderCellStyle(wb); String tableExportTitle = translator.translate("table.export.title"); - Sheet exportSheet = wb.createSheet(tableExportTitle); + String saveTitle = WorkbookUtil.createSafeSheetName(tableExportTitle); + Sheet exportSheet = wb.createSheet(saveTitle); createHeader(table, translator, cdcnt, exportSheet); createData(table, cdcnt, rcnt, exportSheet); diff --git a/src/main/java/org/olat/course/db/CustomDBController.java b/src/main/java/org/olat/course/db/CustomDBController.java index f108b007b17..177293d447f 100644 --- a/src/main/java/org/olat/course/db/CustomDBController.java +++ b/src/main/java/org/olat/course/db/CustomDBController.java @@ -32,6 +32,7 @@ import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.WorkbookUtil; import org.olat.core.CoreSpringFactory; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItem; @@ -264,7 +265,8 @@ public class CustomDBController extends FormBasicController { Workbook wb = new HSSFWorkbook(); CellStyle headerCellStyle = getHeaderCellStyle(wb); - Sheet exportSheet = wb.createSheet(courseTitle); + String saveTitle = WorkbookUtil.createSafeSheetName(courseTitle); + Sheet exportSheet = wb.createSheet(saveTitle); //create the headers Row headerRow = exportSheet.createRow(0); diff --git a/src/main/java/org/olat/instantMessaging/manager/ChatLogHelper.java b/src/main/java/org/olat/instantMessaging/manager/ChatLogHelper.java index f529a98d040..df1157352f2 100644 --- a/src/main/java/org/olat/instantMessaging/manager/ChatLogHelper.java +++ b/src/main/java/org/olat/instantMessaging/manager/ChatLogHelper.java @@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.WorkbookUtil; import org.olat.basesecurity.IdentityImpl; import org.olat.core.gui.media.MediaResource; import org.olat.core.gui.media.WorkbookMediaResource; @@ -115,7 +116,8 @@ public class ChatLogHelper { Workbook wb = new HSSFWorkbook(); String tableExportTitle = translator.translate("logChat.export.title"); - Sheet exportSheet = wb.createSheet(tableExportTitle); + String saveTitle = WorkbookUtil.createSafeSheetName(tableExportTitle); + Sheet exportSheet = wb.createSheet(saveTitle); Formatter formatter = Formatter.getInstance(locale); //headers -- GitLab