Here's what I did,
On creating the template:
1.) Added the toc placeholder by going to Words' References>Add table of contents on page 1.
2.) Added the variable $CONTENTS$ on page 2
On generating the document:
1.) I loaded the template created above.
2.) I used `replaceVariableByHTML` to substitute the $CONTENTS$, the html has h1 tags in them.
But the generated document didnt update the TOC section.
Am I doing something wrong ?