I have two doubts about word,:
- Why I get cell text value is not corrent? The test case shows me that the first line is missing.
- How do I set the first checkbox in cell checked?
Here is my codes:
String path = "C:\\Users\\z_jia\\Desktop\\a\\capa.docx";
Document doc = new Document(path);
Table table = (Table) doc.getChildNodes(NodeType.TABLE, true).get(0);
int count = table.getRows().getCount();
Cell cell = table.getRows().get(count - 1).getCells().get(1);
String s = cell.getText();
StructuredDocumentTag sdtCheckBox = (StructuredDocumentTag) cell.getChild(NodeType.STRUCTURED_DOCUMENT_TAG, 0, true);
//sdtCheckBox is null
// sdtCheckBox.setChecked(true);
doc.save("C:\\Users\\z_jia\\Desktop\\a\\capaoutput.docx");
capa.docx (64.9 KB)