Hi
GayatriK,
you can try to create object of particular toc and try to loop through its fields.
something like below.
Word.Document document = this.Application.ActiveDocument;
Word.TableOfContents oneToC = document.TablesOfContents[1];
oneToC.Range.Select();
foreach (Word.Field f in document.Fields)
{
if (f.Type == Word.WdFieldType.wdFieldTOC)
{
f.Select();
MessageBox.Show( f.ToString());
break;
}
}
Reference:
TablesOfContents Object (Word)
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.