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

Free Support Forum - aspose.com

Table of contents links when converting from Word to PDF

Is there a way to disable creation of the table of contents as hyperlinks when converting from Word to PDF?

See attached TL146 M-1068CA.zip (145.3 KB)


Thanks for your inquiry. Please use following code example to achieve your requirements. Hope this helps you.

Document doc = new Document(MyDir + "TL146 M-1068CA.docx");

IEnumerable<Field> fields = doc.Range.Fields.Cast<Field>().ToList().Where(f => f.Type == FieldType.FieldTOC);
foreach (FieldToc field in fields)
    field.InsertHyperlinks = false;

doc.Save(MyDir + "17.6.pdf");