Skip to main content

SectionProperties.Landscape Property

Specifies the orientation of the section’s pages.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public bool Landscape { get; set; }

Property Value

Type Description
Boolean

true to set the landscape orientation; false to set the portrait orientation.

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 example below 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