WorkbookEventArgs 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
- Inherits
- Event
Args - Workbook
Event Args
- Event
Detached workbook event context. Cancellation is honored by before-events, Loading and Saving.
Syntax
public class WorkbookEventArgs
Members
Constructors
| Constructor | Description |
|---|---|
| Constructor |
Properties
| Property | Description |
|---|---|
| Address | Single-cell address for interaction and editing events. |
| Addresses | Affected A1 cell addresses. |
| AllowInvalid | Explicitly accepts a non-stop validation failure. Stop constraints remain enforced. |
| ByteLength | Known input/output length in bytes. File contents and destination paths are never included. |
| CanCancel | True only for events that can stop the proposed operation. |
| Cancel | Set synchronously in a cancellable event handler to roll back the attempted operation. |
| Completed | Actual completed work in Unit. Counts restart when the phase changes. |
| Data | Detached event-specific values, including input, value or calculation pendingCount. |
| ErrorCode | Diagnostic code on FileOperationFailed, when available. |
| ErrorMessage | Diagnostic message on FileOperationFailed. The method still throws its original exception. |
| IsCanceled | True for a failed operation stopped by an event handler or cancellation request. |
| Name | The event name shared with the JavaScript typed event surface. |
| Operation | File operation kind: load or save. Null for other workbook events. |
| OperationId | Opaque correlation ID for one load/save operation, including concurrent calls. |
| Phase | Processing stage: reading, parsing, snapshot, exporting, rendering, writing or completed. |
| SheetId | Worksheet identity independent of the active sheet. |
| Source | The originating operation, when available. |
| Sources | Contributing operations inside one atomic batch. |
| StreamType | File format involved in the operation. PDF is save-only. |
| Total | Known amount of work in Unit, or null for indeterminate stages. |
| Unit | Progress counter unit: bytes or pages. Null when only a processing phase is known. |
| Warnings | Detached import notices on Loaded; empty for other 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();
}