org.apache.poi.xssf.extractor
Class XSSFEventBasedExcelExtractor
- java.lang.Object
-
- org.apache.poi.POITextExtractor
-
- org.apache.poi.POIXMLTextExtractor
-
- org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable, ExcelExtractor
public class XSSFEventBasedExcelExtractor extends POIXMLTextExtractor implements ExcelExtractor
Implementation of a text extractor from OOXML Excel files that uses SAX event based parsing.
-
-
Constructor Summary
Constructors Constructor and Description XSSFEventBasedExcelExtractor(OPCPackage container)XSSFEventBasedExcelExtractor(java.lang.String path)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Allows to free resources of the Extractor as soon as it is not needed any more.POIXMLProperties.CorePropertiesgetCoreProperties()Returns the core document propertiesPOIXMLProperties.CustomPropertiesgetCustomProperties()Returns the custom document propertiesPOIXMLProperties.ExtendedPropertiesgetExtendedProperties()Returns the extended document propertiesOPCPackagegetPackage()Returns the opened OPCPackage container.java.lang.StringgetText()Processes the file and returns the textstatic voidmain(java.lang.String[] args)voidprocessSheet(XSSFSheetXMLHandler.SheetContentsHandler sheetContentsExtractor, StylesTable styles, CommentsTable comments, ReadOnlySharedStringsTable strings, java.io.InputStream sheetInputStream)Processes the given sheetvoidsetFormulasNotResults(boolean formulasNotResults)Should we return the formula itself, and not the result it produces? Default is falsevoidsetIncludeCellComments(boolean includeCellComments)Should cell comments be included? Default is falsevoidsetIncludeHeadersFooters(boolean includeHeadersFooters)Should headers and footers be included? Default is truevoidsetIncludeSheetNames(boolean includeSheetNames)Should sheet names be included? Default is truevoidsetIncludeTextBoxes(boolean includeTextBoxes)Should text from textboxes be included? Default is truevoidsetLocale(java.util.Locale locale)-
Methods inherited from class org.apache.poi.POIXMLTextExtractor
getDocument, getMetadataTextExtractor
-
-
-
-
Constructor Detail
-
XSSFEventBasedExcelExtractor
public XSSFEventBasedExcelExtractor(java.lang.String path) throws org.apache.xmlbeans.XmlException, OpenXML4JException, java.io.IOException- Throws:
org.apache.xmlbeans.XmlExceptionOpenXML4JExceptionjava.io.IOException
-
XSSFEventBasedExcelExtractor
public XSSFEventBasedExcelExtractor(OPCPackage container) throws org.apache.xmlbeans.XmlException, OpenXML4JException, java.io.IOException
- Throws:
org.apache.xmlbeans.XmlExceptionOpenXML4JExceptionjava.io.IOException
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
setIncludeSheetNames
public void setIncludeSheetNames(boolean includeSheetNames)
Should sheet names be included? Default is true- Specified by:
setIncludeSheetNamesin interfaceExcelExtractor
-
setFormulasNotResults
public void setFormulasNotResults(boolean formulasNotResults)
Should we return the formula itself, and not the result it produces? Default is false- Specified by:
setFormulasNotResultsin interfaceExcelExtractor
-
setIncludeHeadersFooters
public void setIncludeHeadersFooters(boolean includeHeadersFooters)
Should headers and footers be included? Default is true- Specified by:
setIncludeHeadersFootersin interfaceExcelExtractor
-
setIncludeTextBoxes
public void setIncludeTextBoxes(boolean includeTextBoxes)
Should text from textboxes be included? Default is true
-
setIncludeCellComments
public void setIncludeCellComments(boolean includeCellComments)
Should cell comments be included? Default is false- Specified by:
setIncludeCellCommentsin interfaceExcelExtractor
-
setLocale
public void setLocale(java.util.Locale locale)
-
getPackage
public OPCPackage getPackage()
Returns the opened OPCPackage container.- Overrides:
getPackagein classPOIXMLTextExtractor
-
getCoreProperties
public POIXMLProperties.CoreProperties getCoreProperties()
Returns the core document properties- Overrides:
getCorePropertiesin classPOIXMLTextExtractor
-
getExtendedProperties
public POIXMLProperties.ExtendedProperties getExtendedProperties()
Returns the extended document properties- Overrides:
getExtendedPropertiesin classPOIXMLTextExtractor
-
getCustomProperties
public POIXMLProperties.CustomProperties getCustomProperties()
Returns the custom document properties- Overrides:
getCustomPropertiesin classPOIXMLTextExtractor
-
processSheet
public void processSheet(XSSFSheetXMLHandler.SheetContentsHandler sheetContentsExtractor, StylesTable styles, CommentsTable comments, ReadOnlySharedStringsTable strings, java.io.InputStream sheetInputStream) throws java.io.IOException, org.xml.sax.SAXException
Processes the given sheet- Throws:
java.io.IOExceptionorg.xml.sax.SAXException
-
getText
public java.lang.String getText()
Processes the file and returns the text- Specified by:
getTextin interfaceExcelExtractor- Specified by:
getTextin classPOITextExtractor- Returns:
- All the text from the document
-
close
public void close() throws java.io.IOExceptionDescription copied from class:POITextExtractorAllows to free resources of the Extractor as soon as it is not needed any more. This may include closing open file handles and freeing memory. The Extractor cannot be used after close has been called.- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classPOIXMLTextExtractor- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG