Re: Header footer and page number issue

Hello,
I have a document with 3 section, but I have removed section break. Now how I will add page number in footer

Hi there,

Thank for your inquiry. A valid document needs to have at least one section. After removing section breaks, your input document must have one section. You need to move the cursor to the footer of Section using DocumentBuilder.MoveToHeaderFooter method and use DocumentBuilder.InsertField method to insert the page field. Please read following documentation link for your kind reference.
https://docs.aspose.com/words/net/inserting-fields/

If you document does not contain the footer, please use following code example to insert the footer into first section of document. Hope this answers your query. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
HeaderFooter footer = doc.FirstSection.HeadersFooters[HeaderFooterType.FooterPrimary];
if (footer == null)
{
    footer = new HeaderFooter(doc, HeaderFooterType.FooterPrimary);
    doc.FirstSection.HeadersFooters.Add(footer);
}