我如何使用Apache POI读取.doc文件在Java中从文本独立的图像? [英] How do I use Apache POI to read a .DOC file in Java to separate images from text?

查看:180
本文介绍了我如何使用Apache POI读取.doc文件在Java中从文本独立的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要阅读从Java一个Word .doc文件具有文本和图像。我需要认识到的图片及文本和他们分成2个文件。

I need to read a Word .doc file from Java that has text and images. I need to recognize the images & text and separate them into 2 files.

我最近听说阿帕奇POI。我如何使用Apache POI读取的Word .doc文件?

I've recently heard about "Apache POI." How I can use Apache POI to read Word .doc files?

推荐答案

在Apache的网站上的示例和示例code是pretty不错。我建议你​​从那里开始。

The examples and sample code on apache's site are pretty good. I recommend you start there.

<一个href=\"http://poi.apache.org/hwpf/quick-guide.html\">http://poi.apache.org/hwpf/quick-guide.html

要获取文字特定位,首先创建一个org.apache.poi.hwpf.HWPFDocument。获取与getRange()的范围,然后从那个段落。那么你可以得到的文本和其他属性。

To get specific bits of text, first create a org.apache.poi.hwpf.HWPFDocument. Fetch the range with getRange(), then get paragraphs from that. You can then get text and other properties.

<一个href=\"http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java?view=log\">Here用于提取的图像的一个例子。 <一href=\"http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/TestHWPFPictures.java?revision=712084&view=markup\">Here最新的版本写这篇文章的。

Here for an example of extracting an image. Here for the latest revision as of this writing.

当然,在的Javadoc

请注意的是,根据该POI的网站,

Note that, according to the POI site,

HWPF仍处于发展初期。

HWPF is still in early development.

这篇关于我如何使用Apache POI读取.doc文件在Java中从文本独立的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆