'Declaration Public Class WordprocessingMLHeaderFooterWriter Inherits WordHeaderFooterWriter
public class WordprocessingMLHeaderFooterWriter : WordHeaderFooterWriter
The methods exposed by this class are syntactically identical to the corresponding methods of the WordDocumentWriter class. This is because headers and footers can accommodate virtually all the same content that the main document part can accommodate; for example, paragraphs, text runs, hyperlinks, and tables are all valid content for a header or footer section.
At the time that the containing SectionHeaderFooterWriterSet is returned from the AddSectionHeaderFooter method, the XML elements required to reference the header and footer parts have already been written to the content stream - this is a necessary consequence of a forward-only stream writer. These elements refer to the actual header/footer parts in the package; the content for these parts, however, is created via calls to the methods of this class.
This instance stays alive until it is explicitly discarded by the consumer, or until the associated WordDocumentWriter is closed. This means that the developer can write content to the header/footer part at any time during the lifetime of the WordDocumentWriter, although doing so is not recommended as this increases the complexity of the resulting implementation.
Unlike the WordDocumentWriter, which requires a 'StartDocument' method to be called prior to calling content creation methods, all required prologues are automatically written to the content stream when the StartParagraph or StartTable methods are called. Note that all content which appears within a header or footer must appear within one of these two types of content blocks.
Page numbers can be specified for a header or footer using the AddPageNumberField method.
The Close method must be called after all content has been written.
Target Platforms: Windows 8.1, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
View on GitHub