0
我正在試圖使用docx4j api獲取java代碼中的docx文件表格數據。 在這裏,我試圖獲取每個單元格的數據在一次。如何獲得該數據..我在我的代碼有遞歸方法調用。如何將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());
}
}
}