Error No ToC content control found after manipulating docx
Posted: Tue May 07, 2019 3:24 am
When I update the TOC before manipulating the document it works correctly. This is my code:
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 found
Here is the docx that is created:
Thanks!
- 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 found
Here is the docx that is created:
Thanks!