Tika MS Office 文件提取

17 Mar 2025 | 阅读 2 分钟

为了提取 Microsoft Office 文件,例如 xls 文件,Tika 提供了 OOXMLParser 类。 此类用于从 Microsoft 文件中提取内容和元数据。 它位于 org.apache.tika.parser.microsoft.ooxml 包中,并包含各种构造函数和方法,如下表所示。

Tika OOXMLParser 构造函数

构造函数描述
public OOXMLParser()用于实例化类。

方法描述
public Set<MediaType> getSupportedTypes(ParseContext context)返回此解析器支持的媒体类型集。
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException将文档流解析为 XHTML SAX 事件序列。

Tika OOXMLParser 示例

我们的文件包含以下内容。


Tika MS Office File Extraction

输出

Document Content:Sheet1
	Employee Manual Punch
	In Time	Out Time	Device	Total Minute	Total Time	Working Minutes
	01-Nov-17 8:27:00 AM	01-Nov-17 6:30:00 PM	1	603	540	-63
	02-Nov-17 8:09:00 AM	02-Nov-17 6:30:00 PM	1	621	540	-81
	03-Nov-17 8:25:00 AM	03-Nov-17 6:30:00 PM	1	605	540	-65

Document Metadata:
date:   2018-05-06T11:20:06Z
cp:revision:   1
custom:DocSecurity:   0
dc:creator:   Reception
dcterms:created:   2017-12-03T08:38:57Z
language:   en-IN
Last-Modified:   2018-05-06T11:20:06Z
dcterms:modified:   2018-05-06T11:20:06Z
Last-Save-Date:   2018-05-06T11:20:06Z
Template:   
protected:   false
meta:save-date:   2018-05-06T11:20:06Z
Application-Name:   LibreOffice/5.1.6.2$Linux_X86_64 LibreOffice_project/10m0$Build-2
modified:   2018-05-06T11:20:06Z
custom:LinksUpToDate:   false
Content-Type:   application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
creator:   Reception
dc:language:   en-IN
meta:author:   Reception
meta:creation-date:   2017-12-03T08:38:57Z
extended-properties:Application:   LibreOffice/5.1.6.2$Linux_X86_64 LibreOffice_project/10m0$Build-2
custom:ShareDoc:   false
custom:ScaleCrop:   false
Creation-Date:   2017-12-03T08:38:57Z
custom:HyperlinksChanged:   false
Revision-Number:   1
extended-properties:Template:   
custom:AppVersion:   12.0000

下一个主题Tika 提取图像