Section.Margins Property
Returns the section’s page margins.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public IMargins Margins { get; }
Property Value
Type | Description |
---|---|
IMargins | An object that implements the |
Remarks
The Margins
property returns page margins of the current section.
Call the section’s ChangePropertiesAsync(Action<SectionProperties>, CancellationToken) method to change the section margins.
<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.Margins.Left != 700)
properties.Margins.Left = 700;
if (s.Margins.Right != 700)
properties.Margins.Right = 700;
if (s.Margins.Top != 567)
properties.Margins.Top = 567;
if (s.Margins.Bottom != 567)
properties.Margins.Bottom = 567;
});
}
catch (OperationCanceledException e) {
Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
}
}
Use methods of the UnitConverter class to convert centimeters, inches, pixels, or points to twips.
See Also