diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 058e60c7d..c1bfbd318 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -384,7 +384,11 @@ public class HSSFWorkbook windowTwo.setPaged(sheets.size() == 1); sheets.add(clonedSheet); - workbook.setSheetName(sheets.size()-1, srcName+"[1]"); + if (srcName.length()<28) { + workbook.setSheetName(sheets.size()-1, srcName+"(2)"); + }else { + workbook.setSheetName(sheets.size()-1,srcName.substring(0,28)+"(2)"); + } return clonedSheet; } return null; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java index 052516108..6ccf29ec2 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java @@ -79,7 +79,7 @@ public class TestCloneSheet extends TestCase { s.addMergedRegion(new Region((short)0,(short)0,(short)1,(short)1)); b.cloneSheet(0); } - catch(Exception e){fail(e.getMessage());} + catch(Exception e){e.printStackTrace();fail(e.getMessage());} } }