We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to know the document contains TOC or not

How to know the document contains TOC or not.

@Princeshivananjappa,

Here is a sample code to check if it has TOC fields or not.

// check if there are ToC fields
var tocFields = doc.Range.Fields.Where(f => f.Type == FieldType.FieldTOC);

if (tocFields.Any())
    Console.WriteLine("Has ToC elements");
else
    Console.WriteLine("Does not has ToC elements");