Display Word-generated tables of contents with heading hierarchy preservation.
Tables of contents imported from Word documents render as block elements containing the original TOC paragraphs and page references.
Table of contents blocks are managed automatically during Word document import and export. There are no commands to programmatically create or update a TOC.
Word export
Tables of contents export as Word structured document tags with field instructions:
<w:sdt>
<w:sdtPr>
<w:docPartObj/>
</w:sdtPr>
<w:sdtContent>
<w:p>
<w:r><w:fldChar w:fldCharType="begin"/></w:r>
<w:r><w:instrText>TOC \o "1-3"</w:instrText></w:r>
<w:r><w:fldChar w:fldCharType="end"/></w:r>
</w:p>
</w:sdtContent>
</w:sdt>
Source code