跳到主要内容

GetHeader

Returns the content for the specified header type.

Syntax

expression.GetHeader(sType, isCreate);

expression - A variable that represents a ApiSection class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTypeRequiredHdrFtrTypeHeader type to get the content from.
isCreateOptionalbooleanfalseSpecifies 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

Example

This example shows how to get the content for the specified header type.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is a page with a header. ");
paragraph.AddText("See it above.");
let section = doc.GetFinalSection();
let header = section.GetHeader("default", true);
paragraph = header.GetElement(0);
paragraph.AddText("This is a page header");