TX Sheet Control

BlazorSheetControl.GetSelectionAsync Method

Method
Namespace
TXTextControl.TXSheetControl.Blazor
Package
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Blazor.dll from the private NuGet feed or the supplied NuGet folder

Reads detached current screen selection.

Syntax

public Task<SelectionChangedEventArgs> GetSelectionAsync(CancellationToken cancellationToken = default)

Parameters

NameTypeDescription
cancellationTokenCancellationTokenCancellation before starting the operation, with cooperative cancellation for supported file work.

Return Value

Task<SelectionChangedEventArgs>. The awaited operation result, detached from browser transport.

Exceptions

API failures throw ServerSheetControlException with a code. A canceled operation throws OperationCanceledException. Browser filesystem overloads and synchronous C# cell renderers throw PlatformNotSupportedException.

Examples

The control variable is the host received by Ready. File examples use caller-provided xlsxBytes.

var selection = await control.GetSelectionAsync();
var sheet = await control.Workbook.Sheets.GetByIdAsync(selection.SheetId);
await sheet.Cell(selection.Active).SetValueAsync("Selected cell");

Remarks

Await asynchronous operations. Replacement workbook loads invalidate earlier worksheet, cell and range handles. Browser callbacks report completed notifications.

See Also