TextTableOfContentSourceElement textTableOfContentSource = textTableOfContent
.newTextTableOfContentSourceElement();
textTableOfContentSource.setTextOutlineLevelAttribute(10);
textTableOfContentSource.setTextUseIndexMarksAttribute(true);
textTableOfContentSource.setTextUseIndexSourceStylesAttribute(true);
TextIndexTitleTemplateElement textIndexTitleTemplate = textTableOfContentSource
.newTextIndexTitleTemplateElement();
textIndexTitleTemplate
.setTextStyleNameAttribute("Contents_20_Heading");
textIndexTitleTemplate.setTextContent("Table of Contents");
for (int i = 1; i <= 10; i++) {
TextTableOfContentEntryTemplateElement textTableOfContentEntryTemplate = textTableOfContentSource
.newTextTableOfContentEntryTemplateElement(i,
"Contents_20_" + i);
TextIndexEntryLinkStartElement TextIndexEntryLinkStart = textTableOfContentEntryTemplate