Word.HeaderFooterType enum
表示页眉或页脚的类型。
注解
使用方
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/insert-header-and-footer.yaml
// Inserts a primary header by using the HeaderFooterType enum.
await Word.run(async (context) => {
const sections: Word.SectionCollection = context.document.sections;
const firstSection: Word.Section = sections.getFirst();
const headerType: Word.HeaderFooterType = Word.HeaderFooterType.primary;
const primaryHeader: Word.Body = firstSection.getHeader(headerType);
primaryHeader.insertParagraph("This is a primary header.", Word.InsertLocation.end);
await context.sync();
});
字段
| evenPages = "EvenPages" | 返回部分偶数页上的所有页眉或页脚。 |
| firstPage = "FirstPage" | 返回节首页的页眉或页脚。 |
| primary = "Primary" | 返回节的所有页面的页眉或页脚,但排除第一页甚至页面(如果它们不同)。 |