Word.HeaderFooterType enum
Represents the type of header or footer.
Remarks
Used by
Examples
// 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();
});
Fields
| evenPages = "EvenPages" | Returns all headers or footers on even-numbered pages of a section. |
| firstPage = "FirstPage" | Returns the header or footer on the first page of a section. |
| primary = "Primary" | Returns the header or footer on all pages of a section, but excludes the first page or even pages if they are different. |