public class ExcelExtractor extends POIOLE2TextExtractor implements ExcelExtractor
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
document
Constructor and Description |
---|
ExcelExtractor(DirectoryNode dir) |
ExcelExtractor(HSSFWorkbook wb) |
ExcelExtractor(POIFSFileSystem fs) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
_extractHeaderFooter(HeaderFooter hf) |
java.lang.String |
getText()
Retrieves all the text from the document.
|
static void |
main(java.lang.String[] args)
Command line extractor.
|
void |
setFormulasNotResults(boolean formulasNotResults)
Should we return the formula itself, and not the result it produces?
Default is false
|
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.
|
void |
setIncludeCellComments(boolean includeCellComments)
Should cell comments be included?
Default is false
|
void |
setIncludeHeadersFooters(boolean includeHeadersFooters)
Should headers and footers be included in the output?
Default is true
|
void |
setIncludeSheetNames(boolean includeSheetNames)
Should sheet names be included?
Default is true
|
getDocSummaryInformation, getDocument, getMetadataTextExtractor, getRoot, getSummaryInformation
close, setFilesystem
public ExcelExtractor(HSSFWorkbook wb)
public ExcelExtractor(POIFSFileSystem fs) throws java.io.IOException
java.io.IOException
public ExcelExtractor(DirectoryNode dir) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
args
- the command line parametersjava.io.IOException
- if the file can't be read or contains errorspublic void setIncludeSheetNames(boolean includeSheetNames)
ExcelExtractor
setIncludeSheetNames
in interface ExcelExtractor
includeSheetNames
- true
if the sheet names should be includedpublic void setFormulasNotResults(boolean formulasNotResults)
ExcelExtractor
setFormulasNotResults
in interface ExcelExtractor
formulasNotResults
- true
if the formula itself is returnedpublic void setIncludeCellComments(boolean includeCellComments)
ExcelExtractor
setIncludeCellComments
in interface ExcelExtractor
includeCellComments
- true
if cell comments should be includedpublic void setIncludeBlankCells(boolean includeBlankCells)
includeBlankCells
- true
if blank cells should be includedpublic void setIncludeHeadersFooters(boolean includeHeadersFooters)
ExcelExtractor
setIncludeHeadersFooters
in interface ExcelExtractor
includeHeadersFooters
- true
if headers and footers should be includedpublic java.lang.String getText()
POITextExtractor
getText
in interface ExcelExtractor
getText
in class POITextExtractor
public static java.lang.String _extractHeaderFooter(HeaderFooter hf)
Copyright 2020 The Apache Software Foundation or its licensors, as applicable.