TableCell.SplitAsync(Int32, Int32, CancellationToken) Method
Splits the cell into multiple smaller cells.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public ValueTask SplitAsync(
int columnCount,
int rowCount,
CancellationToken cancellationToken = default(CancellationToken)
)
Parameters
Name | Type | Description |
---|---|---|
columnCount | Int32 | The number of columns in the result cell range. |
rowCount | Int32 | The number of rows in the result cell range. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellationToken | CancellationToken | null | An object that propagates a cancellation notification. |
Returns
Type | Description |
---|---|
ValueTask | A structure that stores an awaitable result of an asynchronous operation. |
Remarks
Once you split a cell, its content moves to the first cell in the result cell range. All cells in the result range have the same appearance settings as the initial cell.
The following code snippet splits the first cell into 6 cells (3 columns and 2 rows):
<DxRichEdit @ref="richEdit" />
@code {
DxRichEdit richEdit;
protected override async Task OnAfterRenderAsync(bool firstRender) {
if (firstRender)
try {
await InitializeDocument();
}
catch (TaskCanceledException) { }
await base.OnAfterRenderAsync(firstRender);
}
async Task InitializeDocument() {
/* 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 {
var columnCount = 4;
var rowCount = 5;
richEdit.DocumentAPI.BeginUpdate();
Table firstTable = await richEdit.DocumentAPI.Tables.CreateAsync(0, columnCount, rowCount);
await firstTable.Rows[0].Cells[0].SplitAsync(3, 2);
richEdit.DocumentAPI.EndUpdate();
}
catch (OperationCanceledException e) {
Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
}
}
}
To merge multiple cells in a range, call the MergeCellsAsync method.