We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hide and unhide contain control as per my requirement in same document using JAVA

Hi @tahir.manzoor
I want to hide some contain control field for some time and unhide for some time in the same document as per my requirements. But I not able to do this can u please help me on this.

  1. My input file is “input.docx”. I want to hide “Contracting party address” and “Contracting party name”
  2. After hiding the two field my output document will be “After-hide.docx”
    3.After unhiding the one field “Contracting party name” my output document will be “After-visible.docx”
    Test2.zip (43.3 KB)


In your case, we suggest you please set the font formatting of text as hidden. Following code example shows how to hide the text of content control. Hope this helps you.

Document document = new Document(MyDir + "input.docx");
StructuredDocumentTag sdt = (StructuredDocumentTag) document.getChild(NodeType.STRUCTURED_DOCUMENT_TAG, 1, true);
for(Run run : (Iterable<Run>) sdt.getChildNodes(NodeType.RUN, true))
document.save(MyDir + "20.4.docx");