DocumentInsert |
Each entry shows its text, indented by its level, a dotted leader and the number of the page it points to, and is a link to that page. The page numbers are the ones of the pages after the table of contents is inserted - they are the page labels when the document has page label ranges (see AddPageLabelRange(Int32, PageLabelStyle, String, Int32)). As many pages as the entries need are inserted.
Insert the table of contents after the content it lists is added. Page label ranges already added that start at or after pageIndex move with their pages, so a document can number its content first (for example AddPageLabelRange(0, PageLabelStyle.LowercaseRoman) for a cover and AddPageLabelRange(1, PageLabelStyle.Decimal) for the body) and then insert the table of contents after the cover: the table pages continue the cover's numbering and the body still starts at 1.