Package org.apache.poi.hssf.extractor
Class ExcelExtractor
java.lang.Object
org.apache.poi.extractor.POITextExtractor
org.apache.poi.extractor.POIOLE2TextExtractor
org.apache.poi.hssf.extractor.ExcelExtractor
- All Implemented Interfaces:
Closeable,AutoCloseable,ExcelExtractor
A text extractor for Excel files.
Returns the textual content of the file, suitable for indexing by something like Lucene, but not really intended for display to the user.
To turn an excel file into a CSV or similar, then see the XLS2CSVmra example
- See Also:
-
Field Summary
Fields inherited from class org.apache.poi.extractor.POIOLE2TextExtractor
document -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetText()Retrieves all the text from the document.static voidCommand line extractor.voidsetFormulasNotResults(boolean formulasNotResults) Should we return the formula itself, and not the result it produces? Default is falsevoidsetIncludeBlankCells(boolean includeBlankCells) Should blank cells be output? Default is to only output cells that are present in the file and are non-blank.voidsetIncludeCellComments(boolean includeCellComments) Should cell comments be included? Default is falsevoidsetIncludeHeadersFooters(boolean includeHeadersFooters) Should headers and footers be included in the output? Default is truevoidsetIncludeSheetNames(boolean includeSheetNames) Should sheet names be included? Default is trueMethods inherited from class org.apache.poi.extractor.POIOLE2TextExtractor
getDocSummaryInformation, getDocument, getMetadataTextExtractor, getRoot, getSummaryInformationMethods inherited from class org.apache.poi.extractor.POITextExtractor
close, setFilesystem
-
Constructor Details
-
ExcelExtractor
-
ExcelExtractor
- Throws:
IOException
-
ExcelExtractor
- Throws:
IOException
-
-
Method Details
-
main
Command line extractor.- Parameters:
args- the command line parameters- Throws:
IOException- if the file can't be read or contains errors
-
setIncludeSheetNames
public void setIncludeSheetNames(boolean includeSheetNames) Description copied from interface:ExcelExtractorShould sheet names be included? Default is true- Specified by:
setIncludeSheetNamesin interfaceExcelExtractor- Parameters:
includeSheetNames-trueif the sheet names should be included
-
setFormulasNotResults
public void setFormulasNotResults(boolean formulasNotResults) Description copied from interface:ExcelExtractorShould we return the formula itself, and not the result it produces? Default is false- Specified by:
setFormulasNotResultsin interfaceExcelExtractor- Parameters:
formulasNotResults-trueif the formula itself is returned
-
setIncludeCellComments
public void setIncludeCellComments(boolean includeCellComments) Description copied from interface:ExcelExtractorShould cell comments be included? Default is false- Specified by:
setIncludeCellCommentsin interfaceExcelExtractor- Parameters:
includeCellComments-trueif cell comments should be included
-
setIncludeBlankCells
public void setIncludeBlankCells(boolean includeBlankCells) Should blank cells be output? Default is to only output cells that are present in the file and are non-blank.- Parameters:
includeBlankCells-trueif blank cells should be included
-
getText
Description copied from class:POITextExtractorRetrieves all the text from the document. How cells, paragraphs etc are separated in the text is implementation specific - see the javadocs for a specific project for details.- Specified by:
getTextin interfaceExcelExtractor- Specified by:
getTextin classPOITextExtractor- Returns:
- All the text from the document
-