Hii Team, We are facing an issue with the Table of Contents (TOC) where the TOC link is not redirecting correctly in the HTML output , although it works properly in the Word output .
The issue occurs when we extract the document page by page. During page extraction, the bookmark for item number 18 is removed , which causes the TOC link to stop working. However, the bookmark for item number 19 works correctly .
If we generate the output without splitting the document into pages , the TOC links work as expected.
Below is the code snippet used for extracting pages:
Aspose.Words.Document tempDoc = (Aspose.Words.Document)doc.Clone(false);
Aspose.Words.Document page = null;
for (int i = 0; i < doc.PageCount; i++)
{
page = doc.ExtractPages(i, 1);
tempDoc.AppendDocument(page, ImportFormatMode.KeepSourceFormatting, new ImportFormatOptions() { KeepSourceNumbering = true });
}
tempDoc.Save(@"Documents" + Path.DirectorySeparatorChar + "BookMark.html", options);
Source :
BookMark.docx (42.8 KB)
Output:
BookMark.zip (3.2 KB)
Please review the source file and let us know why the bookmark is being removed during page extraction.