我正在尝试使用docx4j api在 java 代码中获取 docx 文件表数据。在这里,我试图一次获取每个单元格数据。如何获取该数据..在这里我放置具有递归方法调用的代码。
static void walkList1(List children) {
i=children.size();
int i=1;
for (Object o : children) {
if (o instanceof javax.xml.bind.JAXBElement) {
if (((JAXBElement) o).getDeclaredType().getName()
.equals("org.docx4j.wml.Text")) {
org.docx4j.wml.Text t = (org.docx4j.wml.Text) ((JAXBElement) o)
.getValue();
System.out.println(" 1 1 " + t.getValue());
}
}
else if (o instanceof org.docx4j.wml.R) {
org.docx4j.wml.R run = (org.docx4j.wml.R) o;
walkList1(run.getRunContent());
} else {
System.out.println(" IGNORED " + o.getClass().getName());
}
}
}