Class XSSFReader
- java.lang.Object
-
- org.apache.poi.xssf.eventusermodel.XSSFReader
-
- Direct Known Subclasses:
XSSFBReader
public class XSSFReader extends java.lang.Object
This class makes it easy to get at individual parts of an OOXML .xlsx file, suitable for low memory sax parsing or similar. It makes up the core part of the EventUserModel support for XSSF.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XSSFReader.SheetIterator
Iterator over sheet data.static class
XSSFReader.XMLSheetRefReader
static class
XSSFReader.XSSFSheetRef
-
Constructor Summary
Constructors Constructor Description XSSFReader(OPCPackage pkg)
Creates a new XSSFReader, for the given packageXSSFReader(OPCPackage pkg, boolean allowStrictOoxmlFiles)
Creates a new XSSFReader, for the given package
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStream
getSharedStringsData()
Returns an InputStream to read the contents of the shared strings table.SharedStrings
getSharedStringsTable()
Opens up the Shared Strings Table, parses it, and returns a handy object for working with shared strings.java.io.InputStream
getSheet(java.lang.String relId)
Returns an InputStream to read the contents of the specified Sheet.java.util.Iterator<java.io.InputStream>
getSheetsData()
Returns an Iterator which will let you get at all the different Sheets in turn.java.io.InputStream
getStylesData()
Returns an InputStream to read the contents of the styles table.StylesTable
getStylesTable()
Opens up the Styles Table, parses it, and returns a handy object for working with cell stylesjava.io.InputStream
getThemesData()
Returns an InputStream to read the contents of the themes table.java.io.InputStream
getWorkbookData()
Returns an InputStream to read the contents of the main Workbook, which contains key overall data for the file, including sheet definitions.void
setUseReadOnlySharedStringsTable(boolean useReadOnlySharedStringsTable)
boolean
useReadOnlySharedStringsTable()
-
-
-
Constructor Detail
-
XSSFReader
public XSSFReader(OPCPackage pkg) throws java.io.IOException, OpenXML4JException
Creates a new XSSFReader, for the given package- Throws:
java.io.IOException
OpenXML4JException
-
XSSFReader
public XSSFReader(OPCPackage pkg, boolean allowStrictOoxmlFiles) throws java.io.IOException, OpenXML4JException
Creates a new XSSFReader, for the given package- Parameters:
pkg
- anOPCPackage
representing a spreasheet fileallowStrictOoxmlFiles
- whether to try to handle Strict OOXML format files- Throws:
java.io.IOException
OpenXML4JException
-
-
Method Detail
-
setUseReadOnlySharedStringsTable
public void setUseReadOnlySharedStringsTable(boolean useReadOnlySharedStringsTable)
- Parameters:
useReadOnlySharedStringsTable
- if true, the ReadOnlySharedStringsTable is used, SharedStringsTable otherwise- Since:
- POI 5.2.0
-
useReadOnlySharedStringsTable
public boolean useReadOnlySharedStringsTable()
- Returns:
- whether
getSharedStringsTable()
usesSharedStringsTable
orReadOnlySharedStringsTable
. - Since:
- POI 5.2.0
-
getSharedStringsTable
public SharedStrings getSharedStringsTable() throws java.io.IOException, InvalidFormatException
Opens up the Shared Strings Table, parses it, and returns a handy object for working with shared strings.- Throws:
java.io.IOException
InvalidFormatException
- See Also:
setUseReadOnlySharedStringsTable(boolean)
-
getStylesTable
public StylesTable getStylesTable() throws java.io.IOException, InvalidFormatException
Opens up the Styles Table, parses it, and returns a handy object for working with cell styles- Throws:
java.io.IOException
InvalidFormatException
-
getSharedStringsData
public java.io.InputStream getSharedStringsData() throws java.io.IOException, InvalidFormatException
Returns an InputStream to read the contents of the shared strings table.- Throws:
java.io.IOException
InvalidFormatException
-
getStylesData
public java.io.InputStream getStylesData() throws java.io.IOException, InvalidFormatException
Returns an InputStream to read the contents of the styles table.- Throws:
java.io.IOException
InvalidFormatException
-
getThemesData
public java.io.InputStream getThemesData() throws java.io.IOException, InvalidFormatException
Returns an InputStream to read the contents of the themes table.- Throws:
java.io.IOException
InvalidFormatException
-
getWorkbookData
public java.io.InputStream getWorkbookData() throws java.io.IOException, InvalidFormatException
Returns an InputStream to read the contents of the main Workbook, which contains key overall data for the file, including sheet definitions.- Throws:
java.io.IOException
InvalidFormatException
-
getSheet
public java.io.InputStream getSheet(java.lang.String relId) throws java.io.IOException, InvalidFormatException
Returns an InputStream to read the contents of the specified Sheet.- Parameters:
relId
- The relationId of the sheet, from a r:id on the workbook- Throws:
java.io.IOException
InvalidFormatException
-
getSheetsData
public java.util.Iterator<java.io.InputStream> getSheetsData() throws java.io.IOException, InvalidFormatException
Returns an Iterator which will let you get at all the different Sheets in turn. Each sheet's InputStream is only opened when fetched from the Iterator. It's up to you to close the InputStreams when done with each one.- Throws:
java.io.IOException
InvalidFormatException
-
-