https://bz.apache.org/bugzilla/show_bug.cgi?id=61034

            Bug ID: 61034
           Summary: Call to XSSFReader.getSheetsData() returns duplicate
                    sheets
           Product: POI
           Version: 3.16-FINAL
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 34947
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34947&action=edit
use this xlsx file to reproduce the issue.

Call to XSSFReader.getSheetsData() returns duplicate sheets.

The attached xlsx file contains 6 sheets: Sheet1, Sheet2, ..., Sheet6.

The call to XSSFReader.getSheetsData() should return the 6 sheets in the
iterator but it is returning 12 sheets. Each sheet is duplicated.

Steps to reproduce:

Run this code using the attached xlsx file:

OPCPackage p = OPCPackage.open(sourceFilePath);
XSSFReader reader = new XSSFReader(p);
XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator)
reader.getSheetsData();
while (iter.hasNext()) {
  InputStream stream = iter.next();
  String sheetName = iter.getSheetName();
  stream.close();
  System.out.println(sheetName);
}

The output is:
Sheet1
Sheet1
Sheet2
Sheet2
Sheet3
Sheet3
Sheet4
Sheet4
Sheet5
Sheet5
Sheet6
Sheet6

The expected output is:
Sheet1
Sheet2
Sheet3
Sheet4
Sheet5
Sheet6

-- 
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