Hi,
I have a task to load the existing word document inside the Browser.I am using Aspose.Words for .NET to convert word document into HTML, In that i have to remove the page numbers and table of contents, Anybody can able to give a reference or solution for this.
Hi,
Thanks for your inquiry. You can use the following code to remove all PAGE and TOC fields from your document before saving to HTML:
Document doc = new Document(MyDir + @"input.docx");
foreach(FieldStart start in doc.GetChildNodes(NodeType.FieldStart, true))
{
if (start.FieldType == FieldType.FieldPage || start.FieldType == FieldType.FieldTOC)
{
start.GetField().Remove();
}
}
doc.Save(MyDir + @"out.html");
I hope, this helps.
Best regards,
Hi,
Thanks for your reply, Your solution works great for me.