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

# How to add the hyperlink for an existing table of content in the document

How to add the hyperlink for an existing table of content in the document. Kindly help me asap.
Please find the below input and expected word document.

@Manasahr You should set FieldToc.InsertHyperlinks and FieldToc.HideInWebLayout properties to get the desired output. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");

doc.Range.Fields.Where(f => f.Type == FieldType.FieldTOC).Cast<FieldToc>().ToList()
.ForEach(f => { f.InsertHyperlinks = true; f.HideInWebLayout = true; f.Update(); });

doc.Save(@"C:\Temp\out.docx");


@alexey.noskov Why I am getting it question mark symbol(?) in TOC? I need to show the only page number. Kindly help me.
@Manasahr Please call Document.UpdatePageLayout before saving the document to update page numbers in the TOC.