https://issues.apache.org/bugzilla/show_bug.cgi?id=47090

           Summary: Error in "createSheet()" / "cloneSheet()" After
                    "removeSheetAt()"
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=23534)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23534)
Test Spreadsheet

I encountered the following errors when I use "createSheet()" / "cloneSheet()"
after "removeSheetAt()". The test spreadsheet is a .xlsx file which has two
blank sheets.


Case 1
===============
    Workbook workbook = WorkbookFactory.create(new
FileInputStream("Book1.xlsx"));
    workbook.removeSheetAt(0);
    workbook.createSheet();

 Error: java.lang.IllegalArgumentException: The workbook already contains a
sheet of this name


Case 2 
===============
    Workbook workbook = WorkbookFactory.create(new
FileInputStream("Book1.xlsx"));
    workbook.removeSheetAt(1);
    workbook.createSheet();

 Error: org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidOperationException: A part with the
name '/xl/worksheets/sheet2.xml' already exists : Packages shall not contain
equivalent part names and package implementers shall neither create nor
recognize packages with equivalent part names. [M1.12]


Case 3
===============
    Workbook workbook = WorkbookFactory.create(new
FileInputStream("Book1.xlsx"));
    workbook.removeSheetAt(0);
    workbook.cloneSheet(0);

 Error: org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidOperationException: A part with the
name '/xl/worksheets/sheet2.xml' already exists : Packages shall not contain
equivalent part names and package implementers shall neither create nor
recognize packages with equivalent part names. [M1.12]


Case 4
===============
    XSSFWorkbook workbook = new XSSFWorkbook();
    workbook.createSheet();
    workbook.removeSheetAt(0);
    workbook.createSheet();

 Error: org.apache.poi.POIXMLException:
org.apache.poi.openxml4j.exceptions.InvalidOperationException: A part with the
name '/xl/worksheets/sheet1.xml' already exists : Packages shall not contain
equivalent part names and package implementers shall neither create nor
recognize packages with equivalent part names. [M1.12]

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to