Skip to main content

Section.Landscape Property

Gets whether the section’s page orientation is landscape.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public bool Landscape { get; }

Property Value

Type Description
Boolean

true if the orientation is landscape; false if the orientation is portrait.

Remarks

You can set a section’s page orientation in the following ways:

  • Select the Page LayoutOrientationPortrait ribbon command to set page orientation of the selected section to portrait.

  • Select the Page LayoutOrientationLandscape ribbon command to set page orientation of the selected section to landscape.

  • Call the section’s ChangePropertiesAsync method.

The following code snippet sets the orientation of every page in the open document to portrait.

<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;
            var sections = await documentAPI.Sections.GetAllAsync();
            foreach (Section s in sections)
                await s.ChangePropertiesAsync(properties => {
                    if (s.Landscape == true)
                        properties.Landscape = false;
                });
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

If a user changes a page orientation, the PageSize.Width property value becomes the PageSize.Height property value and vice versa. If you change the section’s PageSize.Height and/or PageSize.Width property value, the Rich Text Editor updates the Landscape property with the matching value.

See Also