use of org.apache.poi.xwpf.usermodel.XWPFDocument in project Gargoyle by callakrsos.
the class ReadDoc method main.
/**
* @작성자 : KYJ
* @작성일 : 2016. 1. 25.
* @param args
*/
public static void main(String[] args) {
String filesname = "(APP)(사양서)AprvSampleApp.docx";
try {
XWPFDocument doc = new XWPFDocument(new FileInputStream(filesname));
doc.getBodyElements().forEach(b -> {
BodyElementType elementType = b.getElementType();
if (BodyElementType.TABLE.name().equals(elementType.name())) {
XWPFTable table = (XWPFTable) b;
System.out.println(table);
} else if (BodyElementType.PARAGRAPH.name().equals(elementType.name())) {
System.out.println(b);
} else if (BodyElementType.CONTENTCONTROL.name().equals(elementType.name())) {
System.out.println(b);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations