.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
.newTextIndexEntryLinkStartElement();
TextIndexEntryLinkStart
.setTextStyleNameAttribute("Index_20_Link");
textTableOfContentEntryTemplate
.newTextIndexEntryChapterElement();
textTableOfContentEntryTemplate.newTextIndexEntryTextElement();
TextIndexEntryTabStopElement TextIndexEntryTabStop = textTableOfContentEntryTemplate
.newTextIndexEntryTabStopElement("right");
TextIndexEntryTabStop.setStyleLeaderCharAttribute(".");
textTableOfContentEntryTemplate
.newTextIndexEntryPageNumberElement();
textTableOfContentEntryTemplate
.newTextIndexEntryLinkEndElement();
}
TextIndexBodyElement textIndexBody = textTableOfContent
.newTextIndexBodyElement();
TextIndexTitleElement TextIndexTitle = textIndexBody