Working with Footers in NPOI

Aspose.Words - Working with Footers

Below is the code to demonstrate how to insert footer in word document:

C#

 Document wordDocument = new Document("Convert Word Doc to Other Formats.doc");
 HeaderFooterCollection footers = wordDocument.FirstSection.HeadersFooters;
 foreach (HeaderFooter footer in footers)
 {
    if (footer.HeaderFooterType == HeaderFooterType.FooterFirst |  | footer.HeaderFooterType == HeaderFooterType.FooterPrimary |  | footer.HeaderFooterType ==
    HeaderFooterType.FooterEven)
    Console.WriteLine(footer.GetText());
 }

NPOI HWPF XWPF - Working with Footers

Below is the code to demonstrate how to insert footer in word document using NPOI:

C#

  XWPFDocument wordDocument = new XWPFDocument(new FileStream("Working with Footers.doc", FileMode.Open));
  IList<XWPFFooter> footers = wordDocument.FooterList;
  foreach (XWPFFooter footer in footers)
  {
     Console.WriteLine(footer.Text);
  }

Download Running Code

Download Working with Footers from any of the below mentioned social coding sites:

Download Sample Code

Download Working with Footers from any of the below mentioned social coding sites: