TX Sheet Control

ISheetControl.LoadTextAsync Method

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

Loads UTF-8 CSV, XML or JSON text. Other formats require bytes.

Syntax

public Task<LoadResult> LoadTextAsync(string text, StreamType streamType, LoadOptions? options = null, CancellationToken cancellationToken = default)

Parameters

NameTypeDescription
textstringUTF-8 CSV, XML or JSON text.
streamTypeStreamTypeDocument or text format. PDF is save-only.
optionsLoadOptions?Optional operation settings.
cancellationTokenCancellationTokenCancellation before starting the operation, with cooperative cancellation for supported file work.

Return Value

Task<LoadResult>. 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.

await control.LoadTextAsync("Item,Quantity\nNotebook,5", StreamType.CSV);
var sheet = await control.Workbook.Sheets.AtAsync(0);
await sheet.Cell("C2").SetFormulaAsync("=B2*12");

Remarks

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

See Also