public void DocumentBuilderInsertToc()
{
//ExStart
//ExId:DocumentBuilderInsertTOC
//ExSummary:Shows how to insert a Table of Contents field into a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a table of contents at the beginning of the document.
builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
// The newly inserted table of contents will be initially empty.
// It needs to be populated by updating the fields in the document.
doc.UpdateFields();
//ExEnd
}