Working with Headers in NPOI
Contents
[
Hide
]
Aspose.Words - Working with Headers
The following sample code demonstrates how to create headers/footers using Document object.
C#
Document wordDocument = new Document("Convert Word Doc to Other Formats.doc");
HeaderFooterCollection headers = wordDocument.FirstSection.HeadersFooters;
foreach (HeaderFooter header in headers)
{
if (header.HeaderFooterType == HeaderFooterType.HeaderFirst || header.HeaderFooterType == HeaderFooterType.HeaderPrimary || header.HeaderFooterType ==
HeaderFooterType.HeaderEven)
Console.WriteLine(header.GetText());
}
NPOI HWPF XWPF - Working with Headers
C#
XWPFDocument wordDocument = new XWPFDocument(new FileStream("Working with Headers.doc", FileMode.Open));
IList<XWPFHeader> headers = wordDocument.HeaderList;
foreach (XWPFHeader header in headers)
{
Console.WriteLine(header.Text);
}
Download Running Code
Download Working with Headers from any of the below mentioned social coding sites:
Download Sample Code
Download Working with Headers from any of the below mentioned social coding sites: