Skip to main content

SectionBreakType Enum

Lists the types of a section break.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public enum SectionBreakType

Members

Name Description
NextPage

A new section starts on the next page.

OddPage

A new section begins on the next odd-numbered page.

EvenPage

A new section begins on the next even-numbered page.

Continuous

A new section starts on the following paragraph of the same page. Currently not supported.

Remarks

Use the SectionBreakType enumeration values to specify the type of section break before a new section. Use a CreateAsync method to add a new section to a document.

<DxRichEdit @bind-Selection="@selection" @ref="@richEdit" />
@code {
    DxRichEdit richEdit { get; set; }
    Selection selection { get; set; }

    protected override Task OnAfterRenderAsync(bool firstRender) {
        if (firstRender)
            InitializeDocument();
        return base.OnAfterRenderAsync(firstRender);
    }

    async void InitializeDocument() {
    /* 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 {
            Document documentAPI = richEdit.DocumentAPI;
            await documentAPI.Sections.CreateAsync(richEdit.Selection.CaretPosition, SectionBreakType.EvenPage);      
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}
See Also