.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Section.BeginUpdateHeader() Method

Starts editing the primary header for the current section.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v21.1.Core.dll

Declaration

SubDocument BeginUpdateHeader()

Returns

Type Description
SubDocument

A SubDocument instance that is the header being edited.

Remarks

Use the Section.BeginUpdateHeader - Section.EndUpdateHeader method pair to edit primary (the HeaderFooterType.Primary type) header content. If the document has no header as yet, this method creates a header of the HeaderFooterType.Primary type and opens it for editing.

You can use the Section.HasHeader property to determine whether the document already has a header which is the same for all pages (a header of the HeaderFooterType.Primary type).

Example

Document document = server.Document;
document.AppendSection();
Section firstSection = document.Sections[0];
// Modify the header of the HeaderFooterType.First type.
SubDocument myHeader = firstSection.BeginUpdateHeader(HeaderFooterType.First);
DocumentRange range = myHeader.InsertText(myHeader.CreatePosition(0), " PAGE NUMBER ");
Field fld = myHeader.Fields.Create(range.End, "PAGE \\* ARABICDASH");
myHeader.Fields.Update();
firstSection.EndUpdateHeader(myHeader);
// Display the header of the HeaderFooterType.First type on the first page.
firstSection.DifferentFirstPage = true;
See Also