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

Free Support Forum - aspose.com

Re: Header footer and page number issue

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.

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);