How to read content from ms word files using Jakarta POI

后端 未结 4 1750
忘掉有多难
忘掉有多难 2021-01-25 15:58

I\'ve included jakarta-poi-1.5.1-final-20020615.jar file to read content from ms word.

I am unable to do this ...can anyone help me?

4条回答
  •  盖世英雄少女心
    2021-01-25 16:28

    This method will print the internal runs of the entire document so you will be able to compare the values based on xml text.

    for (XWPFParagraph p : doc.getParagraphs()) {
        for (XWPFRun r : p.getRuns()) {
           String text = r.getText(0);
           System.out.println(text);
         }
    }
    

提交回复
热议问题