User1687629711 posted
There is also help in MSDN on this topic
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.word.document.tablesofcontents(VS.80).aspx
private void DocumentTablesOfContents()
{
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Paragraphs[1].Range.Text =
"Heading 1";
this.Paragraphs[2].Range.Text =
"Heading 2";
object Style1 = Word.WdBuiltinStyle.wdStyleHeading1;
this.Paragraphs[1].set_Style(ref Style1);
object Style2 = Word.WdBuiltinStyle.wdStyleHeading2;
this.Paragraphs[2].set_Style(ref Style2);
object HeadingLevel = 1;
this.TablesOfContents.Add(this.Application.Selection.Range,
ref missing, ref HeadingLevel, ref HeadingLevel,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
}