0

I tried to get Doc/Docx Text content . it seems that apache POI do that . i included the dependencies in pom.xml . I tried many code samples like this :

    File docFile1=new File("c:\\document1.docx")
    FileInputStream inputStream = new FileInputStream(docFile1);
    XWPFDocument docIn = new XWPFDocument(inputStream);
    XWPFWordExtractor extractor = new XWPFWordExtractor(docIn);
    String docText = extractor.getText();

this line of code does not compile . eclipse error is in line 3 (The constructor XWPFDocument(FileInputStream) is undefined ) . Many Web ressources that this should work .but it didn't . any ideas ?

4

1 に答える 1

0

同じ問題を抱えている人のために。最新の POI バージョンを含めると問題が解決します。執筆時点では 3.7 です。

于 2012-11-07T18:59:17.407 に答える