public class ExcelExtractor extends java.lang.Object implements POIOLE2TextExtractor, 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
(Excel 文件的文本提取器。返回文件的文本内容,适合 Lucene 之类的索引,但并不真正打算显示给用户。要将 excel 文件转换为 CSV 或类似文件,请参阅 XLS2CSVmra 示例)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) |
HSSFWorkbook |
getDocument()
Return the underlying POIDocument
(返回底层 POIDocument)
|
HSSFWorkbook |
getFilesystem() |
java.lang.String |
getText()
Retrieves all the text from the document.
(从文档中检索所有文本。)
|
boolean |
isCloseFilesystem() |
static void |
main(java.lang.String[] args)
Command line extractor.
(命令行提取器。)
|
void |
setCloseFilesystem(boolean doCloseFilesystem) |
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
(应该包括工作表名称吗?默认为真)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDocSummaryInformation, getMetadataTextExtractor, getRoot, getSummaryInformation
close
public ExcelExtractor(HSSFWorkbook wb)
public ExcelExtractor(POIFSFileSystem fs) throws java.io.IOException
java.io.IOException
(java.io.IOException)
public ExcelExtractor(DirectoryNode dir) throws java.io.IOException
java.io.IOException
(java.io.IOException)
public static void main(java.lang.String[] args) throws java.io.IOException
args
- the command line parameters
(args - 命令行参数)
java.io.IOException
- if the file can't be read or contains errors
(java.io.IOException - 如果文件无法读取或包含错误)
public void setIncludeSheetNames(boolean includeSheetNames)
ExcelExtractor
setIncludeSheetNames
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setIncludeSheetNames)
includeSheetNames
-
true
if the sheet names should be included
(includeSheetNames - 如果应包含工作表名称,则为 true)
public void setFormulasNotResults(boolean formulasNotResults)
ExcelExtractor
setFormulasNotResults
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setFormulasNotResults)
formulasNotResults
-
true
if the formula itself is returned
(formulasNotResults - 如果返回公式本身,则为 true)
public void setIncludeCellComments(boolean includeCellComments)
ExcelExtractor
setIncludeCellComments
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setIncludeCellComments)
includeCellComments
-
true
if cell comments should be included
(includeCellComments - 如果应该包含单元格注释,则为 true)
public void setIncludeBlankCells(boolean includeBlankCells)
includeBlankCells
-
true
if blank cells should be included
(includeBlankCells - 如果应该包含空白单元格,则为 true)
public void setIncludeHeadersFooters(boolean includeHeadersFooters)
ExcelExtractor
setIncludeHeadersFooters
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setIncludeHeadersFooters)
includeHeadersFooters
-
true
if headers and footers should be included
(includeHeadersFooters - 如果应该包含页眉和页脚,则为 true)
public java.lang.String getText()
POITextExtractor
getText
in interface
POITextExtractor
(接口 POITextExtractor 中的 getText)
getText
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 getText)
public static java.lang.String _extractHeaderFooter(HeaderFooter hf)
public HSSFWorkbook getDocument()
POIOLE2TextExtractor
getDocument
in interface
POIOLE2TextExtractor
(POIOLE2TextExtractor 接口中的getDocument)
getDocument
in interface
POITextExtractor
(接口 POITextExtractor 中的 getDocument)
public void setCloseFilesystem(boolean doCloseFilesystem)
setCloseFilesystem
in interface
POITextExtractor
(接口 POITextExtractor 中的 setCloseFilesystem)
doCloseFilesystem
-
true
(default), if underlying resources/filesystem should be closed on
POITextExtractor.close()
(doCloseFilesystem - true(默认),如果底层资源/文件系统应该在 POITextExtractor.close() 上关闭)
public boolean isCloseFilesystem()
isCloseFilesystem
in interface
POITextExtractor
(接口 POITextExtractor 中的 isCloseFilesystem)
true
, if resources/filesystem should be closed on
POITextExtractor.close()
(true,如果资源/文件系统应该在 POITextExtractor.close() 上关闭)
public HSSFWorkbook getFilesystem()
getFilesystem
in interface
POITextExtractor
(接口 POITextExtractor 中的 getFilesystem)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.