diff options
author | Nick Burch <nick@apache.org> | 2010-08-04 14:13:42 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2010-08-04 14:13:42 +0000 |
commit | ba5f6a5cf3c995d0896b1d2c8a4937f6cd9128aa (patch) | |
tree | f8a42f7b3b41d9951eec94adbcaf384a4e4950b8 /src/examples | |
parent | 79c4de256f76c7b372333552975c8701c7f6a798 (diff) | |
download | poi-ba5f6a5cf3c995d0896b1d2c8a4937f6cd9128aa.tar.gz poi-ba5f6a5cf3c995d0896b1d2c8a4937f6cd9128aa.zip |
Add patch from bug #49690 - Add WorkbookUtil, which provies a way of generating valid sheet names
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@982260 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r-- | src/examples/src/org/apache/poi/hssf/usermodel/examples/NewSheet.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/NewSheet.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/NewSheet.java index 5fdf2dd30d..40754feec4 100644 --- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/NewSheet.java +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/NewSheet.java @@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel.examples; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.ss.util.WorkbookUtil; import java.io.IOException; import java.io.FileOutputStream; @@ -33,7 +34,8 @@ public class NewSheet { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet1 = wb.createSheet("new sheet"); HSSFSheet sheet2 = wb.createSheet(); // create with default name - wb.setSheetName(1, "second sheet"); // setting sheet name later + final String name = "second sheet"; + wb.setSheetName(1, WorkbookUtil.createSafeSheetName(name)); // setting sheet name later FileOutputStream fileOut = new FileOutputStream("workbook.xls"); wb.write(fileOut); fileOut.close(); |