首页 > 代码库 > 通过POI读取word文件

通过POI读取word文件

POI读取word只能读取内容不能读取格式

tm-extractors-0.4.jar

import java.io.FileInputStream; import org.textmining.text.extraction.WordExtractor; public class Test {    public static void main(String[] args) {       try {           FileInputStream in = new FileInputStream("d:\\a.doc");           WordExtractor extractor = new WordExtractor();           System.out.println(in.available());           String str = extractor.extractText(in);           System.out.println(str);       } catch (Exception e) {           e.printStackTrace();       }    }}