Skip to main content

Section.PageSize Property

Gets the height and width of section pages.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ISize PageSize { get; }

Property Value

Type Description
ISize

An object that implements the ISize interface and contains page height and width in twips.

Remarks

The height and width are measured in twips. Use methods of the UnitConverter class to convert other units to twips. Call the section’s ChangePropertiesAsync method to change the height and/or width of the section pages.

The following code snippet sets height and width of every page in a document.

<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.PageSize.Width != UnitConverter.PointsToTwips(595))
                        properties.PageSize.Width = UnitConverter.PointsToTwips(595);
                    if (s.PageSize.Height != UnitConverter.PointsToTwips(842))
                        properties.PageSize.Height = UnitConverter.PointsToTwips(842);
                });
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Use any of the following properties to define the size of the section’s pages:

PageSize
Allows you to specify a custom height and width. Assign them to the PageSize.Height and PageSize.Width properties. The Rich Text Editor updates the PaperKind property with the matching paper size value or sets the PaperKind property to Custom.
PaperKind
Allows you to match the page size to one of the standard paper sizes. Assign a paper size (a value other than Custom) to the PaperKind property. The Rich Text Editor updates the PageSize settings with matching height and width values.

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

See Also