BlazorSheetControl.DisposeAsync Method
- Namespace
TXTextControl.TXSheetControl. Blazor
- Package
TXTextControl.asTXSheetControl. Blazor TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Blazor. dll
Releases the editor, its event subscriptions and this instance's callback reference. Safe to call repeatedly.
Syntax
public ValueTask DisposeAsync()
Return Value
ValueTask. Completes after the operation.
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 component owns its primary control. For a separately owned mail-merge result, dispose the result after saving:
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>()
});
var template = await control.Workbook.CreateMailMergeTemplateAsync();
var result = await template.MergeAsync(new { customer = "Fabrikam" });
try { byte[] pdf = await result.Control.SaveAsync(StreamType.PDF); }
finally { await result.Control.DisposeAsync(); }
Remarks
Disposal is idempotent. The Blazor component disposes its own primary control when removed.