…
asJO(Me).RunMethod("readDocxFile",Array("C:/temp/test.docx"))
End Sub
Sub asJO(o As JavaObject)As JavaObject
Return o
End Sub
#if java
import java.io.File;
import java.io.FileInputStream;
import java.util.List;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
public static void readDocxFile(String fName) {
try {
File file = new File(fName);
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
XWPFDocument document = new XWPFDocument(fis);
List<XWPFParagraph> paragraphs = document.getParagraphs();
for (XWPFParagraph para : paragraphs) {
System.out.println(para.getText());
}
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
}
#End If