Hello,
The addTableContents method allows to add a TOC in documents created from scratch. If you need a TOC when you use a template, you just need to add it in the DOCX when you create the template using Word, LibreOffice, OpenOffice...
Or as explained previously, you can use the MutiMerge class to merge a template with a TOC create from scratch.
Regards.