GetHeader

GetHeader(sType, [isCreate]) → { ApiDocumentContent }

Returns the content for the specified header type.

Parameters:

Name Type Default Description
sType HdrFtrType

Header type to get the content from.

isCreate boolean false

Specifies whether to create a new header or not with the specified header type in case no header with such a type could be found in the current section.

Returns:

Type
ApiDocumentContent

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is a page with a header. ");
oParagraph.AddText("See it above.");
var oSection = oDocument.GetFinalSection();
var oHeader = oSection.GetHeader("default", true);
oParagraph = oHeader.GetElement(0);
oParagraph.AddText("This is a page header");
builder.SaveFile("docx", "GetHeader.docx");
builder.CloseFile();

Resulting document