SubDocument.GetTextSpanAsync(Int32, Int32, CancellationToken) Method
Gets the text span at the specified position.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v22.1.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public ValueTask<TextSpan> GetTextSpanAsync(
int startPosition,
int length,
CancellationToken cancellationToken = default(CancellationToken)
)
Parameters
Name | Type | Description |
---|---|---|
startPosition | Int32 | A start position of the span. |
length | Int32 | A length of the span. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellationToken | CancellationToken | null | An object that propagates a cancellation notification. |
Returns
Type | Description |
---|---|
ValueTask<TextSpan> | A structure that stores an awaitable result of an asynchronous operation. The awaitable result is the text span. |
Remarks
Call the ChangePropertiesAsync(Action<CharacterProperties>, CancellationToken) method to change properties of the text span’s characters.
<DxRichEdit @ref="richEdit" CssClass="w-100 ch-720" />
@code {
DxRichEdit richEdit;
@* ... *@
Document documentAPI = richEdit.DocumentAPI;
@* ... *@
TextSpan boldTextSpan = await documentAPI.GetTextSpanAsync(0, 15);
await boldTextSpan.ChangePropertiesAsync(properties => {
properties.FontBold = true;
});
@* ... *@
}
See Also