Skip to main content
All docs
V25.1
  • Section.GetFooterAsync(HeaderFooterType, Boolean, CancellationToken) Method

    Returns a sub-document that is the section’s footer.

    Namespace: DevExpress.Blazor.RichEdit

    Assembly: DevExpress.Blazor.RichEdit.v25.1.dll

    NuGet Package: DevExpress.Blazor.RichEdit

    Declaration

    public ValueTask<SubDocument> GetFooterAsync(
        HeaderFooterType type = HeaderFooterType.Odd,
        bool createIfNotExist = false,
        CancellationToken cancellationToken = default(CancellationToken)
    )

    Optional Parameters

    Name Type Default Description
    type HeaderFooterType Odd

    The type of footer to be returned.

    createIfNotExist Boolean False

    true to create a footer if it does not exist; false to not create a footer.

    cancellationToken CancellationToken null

    An object that propagates a cancellation notification.

    Returns

    Type Description
    ValueTask<SubDocument>

    A structure that stores an awaitable result of an asynchronous operation. The awaitable result is a sub-document object.

    Remarks

    A main sub-document consists of at least one logical section. Each section can have its own footers of the following types: first, primary, odd, and even.

    Page header and footer

    Call the GetFooterAsync method to get a sub-document that is the section footer. Use the type parameter to specify the type of the footer to return. If the section has no footer of the specified type, you can set createIfNotExist to true to create the new footer.

    <DxRichEdit @ref="richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                Section section = await documentAPI.Sections.GetAsync(0);
                var footer = await section.GetFooterAsync(HeaderFooterType.Primary, true);
                await footer.AddTextAsync(DateTime.Now.Year.ToString());
                @* ... *@
                var fParagraph = await footer.Paragraphs.GetAsync(0);
                await fParagraph.ChangePropertiesAsync(properties => {
                    properties.Alignment = ParagraphAlignment.Center;
                });
                await section.ChangePropertiesAsync(properties => {
                    properties.FooterOffset = 700;
                });
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
    See Also