我写了一个程序来读取我的Microsoft Word文档文件的内容.我的要求是获取word.doc的文档图,我开始阅读我的代码所在的doc文件.
public static void readParagraphs(HWPFDocument doc) throws Exception
{
WordExtractor we = new WordExtractor(doc);
/**Get the total number of paragraphs**/
String[] paragraphs = we.getParagraphText();
System.out.println("Total Paragraphs: "+paragraphs.length);
for (int i = 0; i < paragraphs.length; i++)
{
System.out.println("Length of paragraph "+(i +1)+": "+ paragraphs[i].length());
System.out.println(paragraphs[i].toString());
}
}
Run Code Online (Sandbox Code Playgroud)
but am getting Exception in thread "main" java.lang.NoSuchFieldError: filesystem
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:218)
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:158)
at com.honeywell.corept.srd.ReadDocFileFromJava.readMyDocument(ReadDocFileFromJava.java:25)
at com.honeywell.corept.srd.ReadDocFileFromJava.main(ReadDocFileFromJava.java:18)
Run Code Online (Sandbox Code Playgroud)
这个例外我无法解决这个问题.请帮忙.
| 归档时间: |
|
| 查看次数: |
7580 次 |
| 最近记录: |