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

Free Support Forum - aspose.com

How to read hidden bookmarks [TOC]?

I am creating application to read a word TOC from a word document and create content control for the TOC items by program. After I seen couple posts in the forum I could able to read TOC. The problem I am facing is I am getting first three items book marks out of 19. I think Document.Range.Bookmarks not returning hidden book marks. could you please help on this with sample?

I Used following code to get the TOC item and reading content.

Document doc = new Document(@"C:\Toc\TestFile.docx");
DataTable tocTable = TableOfContentsToDataTable(doc, 0);
ArrayList extractedNodes = ExtractContent(bookmarkStart, bookmarkEnd, false);
Document doc2 = GenerateDocument(doc, extractedNodes);

Sathiyamurthy A
Merrill Corporation
Hi Sathiyamurthy,

Thanks for your inquiry. The bookmarks that are created automatically by Word are hidden. These bookmarks begin with an underscore character (_).

Please note that table of content is built by Microsoft Word when the TOC field is updated. Could you please share your input and expected output documents here for our reference. We will then provide you more information about your query along with code.