Back to Devexpress

SectionBreakType Enum

blazor-devexpress-dot-blazor-dot-richedit-b3283663.md

latest2.0 KB
Original Source

SectionBreakType Enum

Lists the types of a section break.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
public enum SectionBreakType

Members

NameDescription
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.

razor
<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

DevExpress.Blazor.RichEdit Namespace