GetHeader
返回指定页眉类型的内容。
语法
expression.GetHeader(sType, isCreate);
expression - 表示 ApiSection 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| sType | 必需 | HdrFtrType | 要获取内容的页眉类型。 | |
| isCreate | 可选 | boolean | false | 指定在当前节中找不到指定类型的页眉时,是否创建新的页眉。 |
返回值
示例
访问文档中节的页眉区域。
// How do I retrieve the header from a specific section in a document?
// Open the header region to add or inspect text that appears at the top of pages in a document.
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");