TX Sheet Control

ISheetControl.MergeAsync 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

Merges application data into this document and returns detached merge metadata.

Syntax

public Task<JsonElement> MergeAsync(object data, object? options = null, CancellationToken cancellationToken = default)

Parameters

NameTypeDescription
dataobjectSerializable application data for the configured merge bindings.
optionsobject?Optional operation settings.
cancellationTokenCancellationTokenCancellation before starting the operation, with cooperative cancellation for supported file work.

Return Value

Task<JsonElement>. 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 sheet = await control.Workbook.Sheets.AtAsync(0);
await sheet.Cell("F2").SetValueAsync("Customer");
await control.Workbook.SetMailMergeAsync(new
{
    version = 1, bindings = new[] { new { sheetId = sheet.Id, cell = "F2", path = "customer" } },
    repeatBlocks = Array.Empty<object>()
});
await control.MergeAsync(new { customer = "Fabrikam" });

Remarks

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

See Also