GetHeader

function GetHeader(sType: HdrFtrType = null, isCreate: boolean = false): ApiDocumentContent

Description

Returns the content for the specified header type.

Parameters

sTypeHdrFtrTypedefault: null

Header type to get the content from.

isCreatebooleandefault: 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

ApiDocumentContent

Try It

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");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).