Back to Devexpress

Section.BeginUpdateFooter(HeaderFooterType) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-section-dot-beginupdatefooter-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-headerfootertype-x29.md

latest8.6 KB
Original Source

Section.BeginUpdateFooter(HeaderFooterType) Method

Starts editing the document’s footer of the specified type.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
SubDocument BeginUpdateFooter(
    HeaderFooterType type
)
vb
Function BeginUpdateFooter(
    type As HeaderFooterType
) As SubDocument

Parameters

NameTypeDescription
typeHeaderFooterType

A HeaderFooterType enumeration value, representing the type of the footer open for editing.

|

Returns

TypeDescription
SubDocument

A SubDocument instance representing the footer being edited.

|

Remarks

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

You can use the Section.HasFooter property to determine whether the document already has a footer.

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 BeginUpdateFooter(HeaderFooterType) 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.

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

csharp
SubDocument source = sourceSection.BeginUpdateFooter(headerFooterType);
SubDocument target = targetSection.BeginUpdateFooter(headerFooterType);

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

csharp
// Modify the footer of the HeaderFooterType.First type.
SubDocument myFooter = firstSection.BeginUpdateFooter(HeaderFooterType.First);
DocumentRange range = myFooter.InsertText(myFooter.CreatePosition(0), " PAGE NUMBER ");

winforms-richedit-iterate-through-all-sub-documents/CS/SubDocumentHelper.cs#L36

csharp
{
    SubDocument footer = section.BeginUpdateFooter(headerFooterType);
    subDocumentProcessor(footer);

office-file-api-ai-implementation/CS/BusinessObjects/RichEditExtension.cs#L23

csharp
if (section.HasFooter(type)) {
    SubDocument footer = section.BeginUpdateFooter(type);
    UpdateSubDocument(footer, action);

word-document-api-iterate-through-all-sub-documents/CS/SubDocumentHelper.cs#L36

csharp
{
    SubDocument footer = section.BeginUpdateFooter(headerFooterType);
    subDocumentProcessor(footer);

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

vb
If Not sourceSection.HasFooter(headerFooterType) Then Return
Dim source As SubDocument = sourceSection.BeginUpdateFooter(headerFooterType)
Dim target As SubDocument = targetSection.BeginUpdateFooter(headerFooterType)

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

vb
' Modify the footer of the HeaderFooterType.First type.
Dim myFooter As DevExpress.XtraRichEdit.API.Native.SubDocument = firstSection.BeginUpdateFooter(DevExpress.XtraRichEdit.API.Native.HeaderFooterType.First)
Dim range As DevExpress.XtraRichEdit.API.Native.DocumentRange = myFooter.InsertText(myFooter.CreatePosition(0), " PAGE NUMBER ")

winforms-richedit-iterate-through-all-sub-documents/VB/SubDocumentHelper.vb#L31

vb
If section.HasFooter(headerFooterType) Then
    Dim footer As SubDocument = section.BeginUpdateFooter(headerFooterType)
    subDocumentProcessor(footer)

word-document-api-iterate-through-all-sub-documents/VB/SubDocumentHelper.vb#L31

vb
If section.HasFooter(headerFooterType) Then
    Dim footer As SubDocument = section.BeginUpdateFooter(headerFooterType)
    subDocumentProcessor(footer)

See Also

HasFooter(HeaderFooterType)

EditPageFooterCommand

Section Interface

Section Members

DevExpress.XtraRichEdit.API.Native Namespace