Back to Devexpress

Section.BeginUpdateFooter() Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-section-d1bdeafa.md

latest5.5 KB
Original Source

Section.BeginUpdateFooter() Method

Starts editing the primary footer for the current section.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
SubDocument BeginUpdateFooter()
vb
Function BeginUpdateFooter As SubDocument

Returns

TypeDescription
SubDocument

A SubDocument instance that is the footer being edited.

|

Remarks

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

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

Example

View Example

csharp
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
Document document = wordProcessor.Document;
    Section firstSection = document.Sections[0];

    // Check whether the document already has a header (the same header for all pages).
    if (!firstSection.HasHeader(HeaderFooterType.Primary))
    {
        //If not, create an empty header.
        SubDocument headerDocument = firstSection.BeginUpdateHeader();
        headerDocument.Paragraphs.Append();
        firstSection.EndUpdateHeader(headerDocument);
    }
}
vb
Using wordProcessor As New RichEditDocumentServer()
Dim document As Document = wordProcessor.Document
    Dim firstSection As Section = document.Sections(0)

    ' Check whether the document already has a header (the same header for all pages).
    If Not firstSection.HasHeader(HeaderFooterType.Primary) Then
        'If not, create an empty header.
        Dim headerDocument As SubDocument = firstSection.BeginUpdateHeader()
        headerDocument.Paragraphs.Append()
        firstSection.EndUpdateHeader(headerDocument)
    End If
End Using

The following code snippets (auto-collected from DevExpress Examples) contain references to the BeginUpdateFooter() 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.

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

csharp
// Create an empty footer.
SubDocument newFooter = firstSection.BeginUpdateFooter();
firstSection.EndUpdateFooter(newFooter);

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

vb
' Create an empty footer.
Dim newFooter As DevExpress.XtraRichEdit.API.Native.SubDocument = firstSection.BeginUpdateFooter()
firstSection.EndUpdateFooter(newFooter)

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

vb
barCode.Module = 0.5
Dim docFooter As SubDocument = doc.Sections(0).BeginUpdateFooter()
docFooter.Images.Append(barCode.BarCodeImage)

See Also

HasFooter(HeaderFooterType)

EditPageFooterCommand

Section Interface

Section Members

DevExpress.XtraRichEdit.API.Native Namespace