Headers and Footers

  • 3 min to read

Overview

Each section in the document can have its own set of headers and footers. If no headers or footers are defined for a given section, the headers and footers from the previous section (if any) are used. The header (or footer) can be different for odd pages, even pages or the first page.

Client API

The following client commands are available for manipulating headers/footers programmatically. Call the commands in the notation given below:

clientRichEditName.commands.commandName.execute(parameter_if_any)

Command Name Link Description
closeHeaderFooter RichEditCommands.closeHeaderFooter Gets a command to substitute a header/footer sub-document with the main sub-document as an active sub-document.
goToFooter RichEditCommands.goToFooter Gets a command to substitute a header sub-document with a footer sub-document of the same page as an active sub-document.
goToHeader RichEditCommands.goToHeader Gets a command to substitute a footer sub-document with a header sub-document of the same page as an active sub-document.
goToNextHeaderFooter RichEditCommands.goToNextHeaderFooter Gets a command to substitute a current header/footer with a header/footer of the next section as an active sub-document.
goToPreviousHeaderFooter RichEditCommands.goToPreviousHeaderFooter Gets a command to substitute a current header/footer with a header/footer of the previous section as an active sub-document.
insertFooter RichEditCommands.insertFooter Gets a command to create a footer sub-document (if it is not yet created) and set it as an active sub-document instead of the main sub-document.
insertHeader RichEditCommands.insertHeader Gets a command to create a header sub-document (if it is not yet created) and set it as an active sub-document instead of the main sub-document.
linkHeaderFooterToPrevious RichEditCommands.linkHeaderFooterToPrevious Gets a command to link a header/footer to the previous section, so it has the same content.
setDifferentFirstPageHeaderFooter RichEditCommands.setDifferentFirstPageHeaderFooter Gets a command to enable (or disable if it is enabled) a different page header and footer for the first page of the current section.
setDifferentOddAndEvenPagesHeaderFooter RichEditCommands.setDifferentOddAndEvenPagesHeaderFooter Gets a command to enable (or disable if it is enabled) a different page header and footer for odd and even pages of the current section.

Manipulation Through UI

To enter a header (footer) editing mode, use the Header (or Footer) ribbon command located in the ribbon's Insert tab, in the Header & Footer group.

Header

To switch display modes, use the Different First Page and Different Odd & Even Pages ribbon commands (in the Header & Footer context ribbon tab in the Options group).

Header

To insert fields displaying a current page number or the total number of pages, use the Page Number and the Page Count ribbon commands (located in the ribbon's Insert tab in the Header & Footer group). You can also insert required field codes manually.