Here is my code.
Microsoft.Office.Interop.Word.TableOfContents toc = doc1.TablesOfContents.Add(wordsec.Range, ref otrue, ref oUpperHeadingLevel, ref oLowerHeadingLevel, ref missing,
ref missing, ref otrue, ref otrue, ref otrue, ref otrue, ref otrue, ref ofalse);
toc.TabLeader = WdTabLeader.wdTabLeaderDots;
toc.Update();
Microsoft.Office.Interop.Word.Range rngTOC = toc.Range;
if (checkBoxColor.Checked == true)
{
rngTOC.Font.Color = WdColor.wdColorBlue;
}
wordsec.set_Style(WdBuiltinStyle.wdStyleNormal);
this.Hide();