日期:2014-05-17 浏览次数:20823 次
public static void main(String[] args) {
File file = new File("D:/test.doc");
try {
FileInputStream fis = new FileInputStream(file);
HWPFDocument hwpfd = new HWPFDocument(fis);
WordExtractor wordExtractor = new WordExtractor(hwpfd);
String[] paragraph = wordExtractor.getParagraphText();
for (int i = 0; i < paragraph.length; i++) {
System.out.println(paragraph[i]);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}