Back to Devexpress

Section.EndUpdateHeader(SubDocument) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-section-dot-endupdateheader-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-x29.md

latest7.4 KB
Original Source

Section.EndUpdateHeader(SubDocument) Method

Finalizes editing of the section’s header.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void EndUpdateHeader(
    SubDocument document
)
vb
Sub EndUpdateHeader(
    document As SubDocument
)

Parameters

NameTypeDescription
documentSubDocument

A SubDocument instance, representing the header open for editing.

|

Remarks

Use the Section.BeginUpdateHeader - Section.EndUpdateHeader method pair to edit header content.

Example

View Example

csharp
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;
vb
Dim document As Document = server.Document
document.AppendSection()
Dim firstSection As Section = document.Sections(0)
' Modify the header of the HeaderFooterType.First type.
Dim myHeader As SubDocument = firstSection.BeginUpdateHeader(HeaderFooterType.First)
Dim range As DocumentRange = myHeader.InsertText(myHeader.CreatePosition(0), " PAGE NUMBER ")
Dim fld As Field = 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

The following code snippets (auto-collected from DevExpress Examples) contain references to the EndUpdateHeader(SubDocument) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/HeaderAndFooterActions.cs#L18

csharp
SubDocument newHeader = firstSection.BeginUpdateHeader();
firstSection.EndUpdateHeader(newHeader);
// Check whether the document already has a header (the same header for all pages).

word-document-api-examples/CS/CodeExamples/HeaderAndFooterActions.cs#L27

csharp
newHeader.AppendText("Header");
    firstSection.EndUpdateHeader(newHeader);
}

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/HeaderAndFooter.cs#L23

csharp
headerDocument.AppendText("Header");
    firstSection.EndUpdateHeader(headerDocument);
}

word-processing-merge-documents-with-different-headers-and-footers/CS/Helpers/SectionsMerger.cs#L38

csharp
sourceSection.EndUpdateHeader(source);
targetSection.EndUpdateHeader(target);

word-document-api-use-track-changes/CS/word-processing-document-api-track-changes/Program.cs#L39

csharp
documentRevisions.RejectAll(header);
documentProcessor.Document.Sections[0].EndUpdateHeader(header);

word-document-api-examples/VB/CodeExamples/HeaderAndFooterActions.vb#L24

vb
newHeader.AppendText("Header")
    firstSection.EndUpdateHeader(newHeader)
End If

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/HeaderAndFooter.vb#L21

vb
headerDocument.AppendText("Header")
    firstSection.EndUpdateHeader(headerDocument)
End If

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/HeaderAndFooterActions.vb#L15

vb
Dim newHeader As SubDocument = firstSection.BeginUpdateHeader()
firstSection.EndUpdateHeader(newHeader)
' Check whether the document already has a header (the same header for all pages).

word-processing-merge-documents-with-different-headers-and-footers/VB/Helpers/SectionsMerger.vb#L35

vb
target.Delete(emptyParagraph)
sourceSection.EndUpdateHeader(source)
targetSection.EndUpdateHeader(target)

word-document-api-insert-inline-pictures/VB/InlinePictures/Program.vb#L37

vb
docHeader.Images.Append(DocumentImageSource.FromUri(imageUri, server))
doc.Sections(0).EndUpdateHeader(docHeader)
' Insert a barcode.

See Also

Section Interface

Section Members

DevExpress.XtraRichEdit.API.Native Namespace