Class XSSFReader.SheetIterator
java.lang.Object
org.apache.poi.xssf.eventusermodel.XSSFReader.SheetIterator
- All Implemented Interfaces:
Iterator<InputStream>
- Direct Known Subclasses:
XSSFBReader.SheetIterator
- Enclosing class:
- XSSFReader
Iterator over sheet data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Iterator<XSSFReader.XSSFSheetRef>Iterator over CTSheet objects, returns sheets inlogicalorder.protected final Map<String,PackagePart> Maps relId and the corresponding PackagePartprotected XSSFReader.XSSFSheetRefCurrent sheet reference -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstruct a new SheetIterator -
Method Summary
Modifier and TypeMethodDescriptionprotected Iterator<XSSFReader.XSSFSheetRef>Returns the shapes associated with this sheet, an empty list or null if there is an exceptionReturns the comments associated with this sheet, or null if there aren't anyReturns name of the current sheetgetSheetPart(XSSFReader.XSSFSheetRef sheetRef) Returns the package part for a sheet, regardless of the position of this iterator.Returns all the sheet references, inlogicalorder, regardless of the position of this iterator.Gets string representations of relationships that are sheet-like.booleanhasNext()Returnstrueif the iteration has more elements.next()Returns input stream of the next sheet in the iterationprotected CommentsparseComments(PackagePart commentsPart) voidremove()We're read only, so remove isn't supportedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
sheetMap
Maps relId and the corresponding PackagePart -
xssfSheetRef
Current sheet reference -
sheetIterator
Iterator over CTSheet objects, returns sheets inlogicalorder. We can't rely on the Ooxml4J's relationship iterator because it returns objects in physical order, i.e. as they are stored in the underlying package
-
-
Constructor Details
-
SheetIterator
Construct a new SheetIterator- Parameters:
wb- package part holding workbook.xml- Throws:
InvalidFormatException- if the sheet data format is invalidIOException- if there is an I/O issue reading the data
-
-
Method Details
-
getSheetRefs
Returns all the sheet references, inlogicalorder, regardless of the position of this iterator. Use withgetSheetPart(XSSFSheetRef)for random access to the sheets.- Returns:
- unmodifiable list of the sheet references
- Since:
- 6.0.0
-
getSheetPart
Returns the package part for a sheet, regardless of the position of this iterator.- Parameters:
sheetRef- one of the sheet references returned bygetSheetRefs()- Returns:
- the package part holding the sheet data, or null if it is missing
- Since:
- 6.0.0
-
createSheetIteratorFromWB
protected Iterator<XSSFReader.XSSFSheetRef> createSheetIteratorFromWB(PackagePart wb) throws IOException - Throws:
IOException
-
getSheetRelationships
Gets string representations of relationships that are sheet-like. Added to allow subclassing by XSSFBReader. This is used to decide what relationships to load into the sheetRefs- Returns:
- all relationships that are sheet-like
-
hasNext
public boolean hasNext()Returnstrueif the iteration has more elements.- Specified by:
hasNextin interfaceIterator<InputStream>- Returns:
trueif the iterator has more elements.
-
next
Returns input stream of the next sheet in the iteration- Specified by:
nextin interfaceIterator<InputStream>- Returns:
- input stream of the next sheet in the iteration
- Throws:
POIXMLException- if the sheet part is invalid
-
getSheetName
Returns name of the current sheet- Returns:
- name of the current sheet
-
getSheetComments
Returns the comments associated with this sheet, or null if there aren't any -
parseComments
- Throws:
IOException
-
getShapes
Returns the shapes associated with this sheet, an empty list or null if there is an exception -
getSheetPart
-
remove
public void remove()We're read only, so remove isn't supported- Specified by:
removein interfaceIterator<InputStream>
-