Tagged: word

04

poi解析word

package poitest;

import java.io.File;

import java.io.FileInputStream;

import org.apache.poi.hwpf.extractor.WordExtractor;

public class Main {

public static void main(String[] args) throws Exception {

// TODO code application logic here

FileInputStream in = new FileInputStream(new File(“a.doc”));

WordExtractor extractor = null;

String text = null;

extractor = new WordExtractor(in);

text = extractor.getText();

System.out.println(text);

in.close();

}

}

结果:

run:

我靠 ,今天很不爽。博客登陆不上了,看来此地不宜久留,我要闪,但是闪到何处呢?

成功生成(总时间:0 秒)

0
comments