WorkbookEvents Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Api. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
Typed, synchronous workbook events. Handlers must not call document methods.
Syntax
public class WorkbookEvents
Members
Events
Examples
Subscribe while processing a document and return detached notifications for the application UI or audit trail. Handlers are synchronous: do not call document methods inside them. Only matching operations raise the selected event.
using TXTextControl.TXSheetControl.Server;
async Task<string[]> CaptureReportNotificationsAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
var events = new List<string>();
void OnNotification(object? sender, WorkbookEventArgs args)
{
events.Add(args.Name + ": " + string.Join(", ", args.Addresses));
}
book.Events.Changed += OnNotification;
try
{
await sheet.Cell("A1").SetTextAsync("October invoice");
await sheet.Cell("A1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
await control.SaveAsync(StreamType.PDF);
}
finally
{
book.Events.Changed -= OnNotification;
}
return events.ToArray();
}
See Also
Blazor Notifications
The browser host forwards completed notifications asynchronously. Before-events, synchronous loading and saving cancellation hooks, and ValidationFailed are not forwarded to C#. Configure validation rules in the workbook before editing. The component Event callback covers its forwarded notifications and progress, and SelectionChanged reports the screen selection. Handle errors from awaited API methods where they are called.