public class EventBasedExcelExtractor extends java.lang.Object implements POIOLE2TextExtractor, ExcelExtractor
ExcelExtractor
, but may not provide the same richness of formatting. 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 文件的文本提取器,它基于 HSSF EventUserModel API。它通常比 ExcelExtractor 使用更少的内存,但可能无法提供同样丰富的格式设置。返回文件的文本内容,适合 Lucene 之类的索引,但并不真正打算显示给用户。要将 excel 文件转换为 CSV 或类似文件,请参阅 XLS2CSVmra 示例)Constructor and Description |
---|
EventBasedExcelExtractor(DirectoryNode dir) |
EventBasedExcelExtractor(POIFSFileSystem fs) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Allows to free resources of the Extractor as soon as it is not needed any more.
(允许在不再需要提取器时释放资源。)
|
DocumentSummaryInformation |
getDocSummaryInformation()
Would return the document information metadata for the document, if we supported it
(如果我们支持它,将返回文档的文档信息元数据)
|
POIDocument |
getDocument()
Return the underlying POIDocument
(返回底层 POIDocument)
|
java.io.Closeable |
getFilesystem() |
DirectoryEntry |
getRoot()
Return the underlying DirectoryEntry of this document.
(返回此文档的基础 DirectoryEntry。)
|
SummaryInformation |
getSummaryInformation()
Would return the summary information metadata for the document, if we supported it
(如果我们支持它,将返回文档的摘要信息元数据)
|
java.lang.String |
getText()
Retreives the text contents of the file
(检索文件的文本内容)
|
boolean |
isCloseFilesystem() |
void |
setCloseFilesystem(boolean doCloseFilesystem) |
void |
setFormulasNotResults(boolean formulasNotResults)
Should we return the formula itself, and not the result it produces? Default is false
(我们应该返回公式本身,而不是它产生的结果吗?默认为假)
|
void |
setIncludeCellComments(boolean includeComments)
Would control the inclusion of cell comments from the document, if we supported it
(如果我们支持,将控制包含文档中的单元格注释)
|
void |
setIncludeHeadersFooters(boolean includeHeadersFooters)
Would control the inclusion of headers and footers from the document, if we supported it
(如果我们支持它,将控制文档中页眉和页脚的包含)
|
void |
setIncludeSheetNames(boolean includeSheetNames)
Should sheet names be included? Default is true
(应该包括工作表名称吗?默认为真)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetadataTextExtractor
public EventBasedExcelExtractor(DirectoryNode dir)
public EventBasedExcelExtractor(POIFSFileSystem fs)
public DocumentSummaryInformation getDocSummaryInformation()
getDocSummaryInformation
in interface
POIOLE2TextExtractor
(POIOLE2TextExtractor 接口中的 getDocSummaryInformation)
public SummaryInformation getSummaryInformation()
getSummaryInformation
in interface
POIOLE2TextExtractor
(POIOLE2TextExtractor 接口中的getSummaryInformation)
public void setIncludeCellComments(boolean includeComments)
setIncludeCellComments
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setIncludeCellComments)
includeComments
-
true
if cell comments should be included
(includeComments - 如果应该包含单元格注释,则为 true)
public void setIncludeHeadersFooters(boolean includeHeadersFooters)
setIncludeHeadersFooters
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setIncludeHeadersFooters)
includeHeadersFooters
-
true
if headers and footers should be included
(includeHeadersFooters - 如果应该包含页眉和页脚,则为 true)
public void setIncludeSheetNames(boolean includeSheetNames)
setIncludeSheetNames
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setIncludeSheetNames)
includeSheetNames
-
true
if the sheet names should be included
(includeSheetNames - 如果应包含工作表名称,则为 true)
public void setFormulasNotResults(boolean formulasNotResults)
setFormulasNotResults
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 setFormulasNotResults)
formulasNotResults
-
true
if the formula itself is returned
(formulasNotResults - 如果返回公式本身,则为 true)
public java.lang.String getText()
getText
in interface
POITextExtractor
(接口 POITextExtractor 中的 getText)
getText
in interface
ExcelExtractor
(接口 ExcelExtractor 中的 getText)
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 java.io.Closeable getFilesystem()
getFilesystem
in interface
POITextExtractor
(接口 POITextExtractor 中的 getFilesystem)
public POIDocument getDocument()
POIOLE2TextExtractor
getDocument
in interface
POIOLE2TextExtractor
(POIOLE2TextExtractor 接口中的getDocument)
getDocument
in interface
POITextExtractor
(接口 POITextExtractor 中的 getDocument)
public DirectoryEntry getRoot()
POIOLE2TextExtractor
getRoot
in interface
POIOLE2TextExtractor
(POIOLE2TextExtractor 接口中的getRoot)
public void close() throws java.io.IOException
POITextExtractor
close
in interface
java.io.Closeable
(在接口 java.io.Closeable 中关闭)
close
in interface
java.lang.AutoCloseable
(在接口 java.lang.AutoCloseable 中关闭)
close
in interface
POITextExtractor
(在界面 POITextExtractor 中关闭)
java.io.IOException
(java.io.IOException)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.