Search code examples
javaxmldocxdocx4j

Why Docx4j is not removing Content Controls from docx files?


I am trying to merge XML and docx using DOcx4J. But even if I use the flag Docx4J.FLAG_BIND_REMOVE_SDT Docx4J is not removing the Content controls from the docx file. I am using the below code.

WordprocessingMLPackage wordprocessingMLPackage = Docx4J.load(new File(docx_template_location));
FileInputStream xmlStream = new FileInputStream(new File(xml_data_location));
Docx4J.bind(wordprocessingMLPackage, xmlStream, Docx4J.FLAG_BIND_INSERT_XML & Docx4J.FLAG_BIND_REMOVE_SDT);
Docx4J.save(wordprocessingMLPackage, new File(required_outputfile_name), Docx4J.FLAG_SAVE_ZIP_FILE);

Solution

  • See this commit

    Prior to that (on 3.3 branch), it removed only OpenDoPE content controls