Продукты Р7
Корпоративный сервер 2024
Корпоративный сервер 2024
Сервер документов
Сервер документов
Редакторы
Редакторы
Корпоративный сервер 2019
Корпоративный сервер 2019
Графика
Графика
Команда
Команда
Мобильные редакторы
Мобильные редакторы
Облачный офис
Облачный офис
Почта
Почта
Органайзер
Органайзер
Дополнительно
Часто задаваемые вопросы
Разработчикам
Интеграции
Новые возможности

SetEvenAndOddHdrFtr

Обновлено: 15.12.25

SetEvenAndOddHdrFtr(isEvenAndOdd)

Указывает, будут ли разделы в этом документе иметь разные верхние и нижние колонтитулы для четных и нечетных страниц (один верхний/нижний колонтитул для нечетных страниц и другой верхний/нижний колонтитул для четных страниц).

Параметры:

Название Тип Описание
isEvenAndOdd логический При значении true верхний/нижний колонтитулы будут разными для нечетных и четных страниц, при значении false они будут одинаковыми.

Возвращает:

Этот метод не возвращает никаких данных.

Пример

builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oSection = oDocument.CreateSection(oParagraph);
oParagraph.AddText("This is section #1 of the document. ");
oParagraph.AddText("It has a header and a footer for odd pages. ");
oParagraph.AddText("Scroll down to see the other pages.");
var oHeader = oSection.GetHeader("default", true);
oParagraph = oHeader.GetElement(0);
oParagraph.AddText("This is an odd page header");
var oFooter = oSection.GetFooter("default", true);
oParagraph = oFooter.GetElement(0);
oParagraph.AddText("This is an odd page footer");
oDocument.SetEvenAndOddHdrFtr(true);
oParagraph = Api.CreateParagraph();
oSection = oDocument.CreateSection(oParagraph);
oSection.SetType("evenPage");
oParagraph.AddText("This is section #2 of the document. ");
oParagraph.AddText("It has a header and a footer for even pages. ");
oParagraph.AddText("Scroll down to see the other pages.");
oDocument.Push(oParagraph);
oHeader = oSection.GetHeader("even", true);
oParagraph = oHeader.GetElement(0);
oParagraph.AddText("This is an even page header");
oFooter = oSection.GetFooter("even", true);
oParagraph = oFooter.GetElement(0);
oParagraph.AddText("This is an even page footer");
oParagraph = Api.CreateParagraph();
oSection = oDocument.CreateSection(oParagraph);
oSection.SetType("oddPage");
oParagraph.AddText("This is section #3 of the document. ");
oParagraph.AddText("It has a header and a footer for odd pages. ");
oParagraph.AddText("Scroll down to see the other pages.");
oDocument.Push(oParagraph);
oSection = oDocument.GetFinalSection();
oSection.SetType("evenPage");
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is section #4 of the document. ");
oParagraph.AddText("It has a header and a footer for even pages.");
oDocument.Push(oParagraph);
builder.SaveFile("docx", "SetEvenAndOddHdrFtr.docx");
builder.CloseFile();