使用Java读取Word,最简单的几句话,使用WordExtractor

使用WordExtractor读取Word文档,请先下载 tm-extractors-0.4.jar

import java.io.FileInputStream; import org.textmining.text.extraction.WordExtractor; public class WordTest { public static void main(String args[]) throws Exception { new WordTest().readByOther(); } public void readByText() throws Exception { FileInputStream in = new FileInputStream("C://test.doc "); WordExtractor extractor = new WordExtractor(); String str = extractor.extractText(in); System.out.println(str); } }

你可能感兴趣的:(java,exception,String,Class,文档,import)