Aspose not reading Table of contents of document

Hi,

We are using RenderedDocument class to read the content of the document.but we have issue in reading complete document content.We are trying to read total document content using aspose rendered document but we are not able to read the document table of content.The complete document table of content is coming as “[|No table of contents entries found.]”.

we are using Aspose.Words v17.7.0.0. I have given the sample file in attached sample zip file to reproduce the issue.

Below is the sample code.

RenderedDocument layoutDoc = new RenderedDocument(AsposeDocument);

foreach (RenderedPage page in layoutDoc.Pages)
{

}Aspose_issue.zip (55.1 KB)

@Gayatri_K

Thank you for your inquiry. We have investigated this scenario and it is working properly using Aspose.Words 17.12. We suggest you to please upgrade to latest version of Aspose.Words 17.12. Please have a look at this sample code and for more detailson Work with the Table of Contents Field.

    Document doc = new Document(dataDir + @"Test Agreement1.docx");

    Console.Write("Document Text: " + doc.GetText());

    foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
    {
        if (para.ParagraphFormat.Style.Name.Contains("TOC"))
        {
            Console.WriteLine("TOC Paragraph: " + para.GetText());
        }
    }

    // OR

    RenderedDocument layoutDoc = new RenderedDocument(doc);
    foreach (RenderedPage page in layoutDoc.Pages)
    {
        foreach (Paragraph para in page.Section.GetChildNodes(NodeType.Paragraph, true))
        {
            if (para.ParagraphFormat.Style.Name.Contains("TOC"))
            {
                Console.WriteLine("TOC Paragraph: " + para.GetText());
            }
        }
    }