using the following code (on the attached word document) not all the content controls are shown:
void testCCIdFromDoc() throws Exception {
Document document = new Document(MyTest.class.getResourceAsStream("/wordDocs/Example.docx"));
NodeCollection childNodes = document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
for (int i = 0; i < childNodes.getCount(); i++) {
StructuredDocumentTag std = (StructuredDocumentTag) childNodes.get(i);
System.out.println("signed: " + std.getId() + " " + std.getNodeType() + " " + std.getTitle());
}
childNodes = document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG_RANGE_START, true);
for (int i = 0; i < childNodes.getCount(); i++) {
StructuredDocumentTagRangeStart std = (StructuredDocumentTagRangeStart) childNodes.get(i);
System.out.println("signed: " + std.getId() + " " + std.getNodeType() + " " + std.getTitle());
}
}
What is the problem?
Example.docx (211,1 KB)
@ernestocastellano The above provide code returns 40 content controls on my side. Could you please specify which content control is missed?
I’m using version 24.4 of aspose-words library. Launching the provided code this is the console output:
signed: -1117599021 28 Include: COVER - COVER PAGE
signed: -1132097020 28 DATE
signed: 280779116 28
signed: -1737932262 28 Include: 010 - Face Financials
signed: 1395009425 28 BALANCE SHEET
signed: 355010416 28 REF_DATE
signed: -120846779 29 Include: 001 - Financial Statements and Notes
All other content controls are missed
@ernestocastellano Most likely you are using Aspose.Words in evaluation mode and your document is truncated due to the evaluation version limitations. In evaluation mode Aspose.Words has only two limitations: it limits the maximum size of the processed document to several hundred of paragraphs and injects an evaluation watermark into the document. If you would like to test Aspose.Words without evaluation version limitations, you can request a free 30-days temporary license . Please see our documentation to learn more about licensing:
https://docs.aspose.com/words/java/licensing/
Thanks. The problem was the license!!
1 Like
It’s possible that some content controls need this
document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG_RANGE_END, true);
to be found or the previous in the code attached are sufficient?
@ernestocastellano Yes, it is required to import both start and end of ranged SDT. But it is also required to use the same NodeImporter
to import them, as suggested in the code above.