When I update the TOC before manipulating the document it works correctly. This is my code:
- Code: Select all
WordprocessingMLPackage wordMLPackage = Docx4J.load(new File(myTemplate));
TocGenerator tocGenerator = new TocGenerator(wordMLPackage);
tocGenerator.updateToc(false);
The problem is I need to call updateToc at the end of method after I insert data into the document. When calling updateToc (the same way I call it originally) after inserting data I get the error:
No ToC content control foundHere is the docx ...