From 4d48741ce0af65535e88dafdf379392aebdd328f Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Fri, 12 Oct 2012 23:05:17 +0000 Subject: [PATCH] FIXED - task 574: create safe sheet names for Excel export - patch from jd@tekii.com.ar http://code.google.com/p/google-refine/issues/detail?id=574 git-svn-id: http://google-refine.googlecode.com/svn/trunk@2582 7d457c2a-affb-35e4-300a-418c747d4874 --- main/src/com/google/refine/exporters/XlsExporter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/src/com/google/refine/exporters/XlsExporter.java b/main/src/com/google/refine/exporters/XlsExporter.java index a71189d85..1d2bd0f5b 100644 --- a/main/src/com/google/refine/exporters/XlsExporter.java +++ b/main/src/com/google/refine/exporters/XlsExporter.java @@ -47,6 +47,7 @@ import org.apache.poi.ss.usermodel.CellStyle; 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.apache.poi.xssf.usermodel.XSSFWorkbook; import org.json.JSONObject; @@ -80,7 +81,9 @@ public class XlsExporter implements StreamExporter { @Override public void startFile(JSONObject options) { s = wb.createSheet(); - wb.setSheetName(0, ProjectManager.singleton.getProjectMetadata(project.id).getName()); + String sheetName = WorkbookUtil.createSafeSheetName( + ProjectManager.singleton.getProjectMetadata(project.id).getName()); + wb.setSheetName(0, sheetName); dateStyle = wb.createCellStyle(); dateStyle.setDataFormat(