Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
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());
}
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 Working with Headers from any of the below mentioned social coding sites:
Download Working with Headers from any of the below mentioned social coding sites:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.