SectionProperties.PageSize Property
Specifies the height and width of the section’s pages.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public ElementSize PageSize { get; set; }
Property Value
Type | Description |
---|---|
ElementSize | An object that contains a 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 andPageSize
.Width properties. The Rich Text Editor updates the PaperKind property with the matching paper size value or sets the PaperKind property toCustom
. - 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 thePaperKind
property. The Rich Text Editor updates thePageSize
settings with matching height and width values.
The Landscape property defines a page orientation. If a user changes a 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.