# WorkbookDataBinding Class

> WorkbookDataBinding class in the TX Sheet Control .NET API: Optional bridge for one workbook lifetime. Fetch completes before mutation.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Namespace:** `TXTextControl.TXSheetControl.Data`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Server.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Implements:** `System.IDisposable`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Data > WorkbookDataBinding Class
- **1381 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/llms-full.txt

---

Optional bridge for one workbook lifetime. Fetch completes before mutation; latest refresh wins per target. Loading cancels pending refreshes. Host owns authorization and scheduling; dispose when the host is destroyed.

### Syntax

```csharp
public class WorkbookDataBinding
```

Interfaces: `IDisposable`.

### Members

#### Constructors

| Constructor | Description |
|---|---|
| [Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/constructor/llms-full.txt) | Creates a bridge for one workbook. Registry and workbook ownership remain with the application. |

#### Methods

| Method | Description |
|---|---|
| [Dispose](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/dispose-method/llms-full.txt) | Cancels all in-flight refreshes and releases event subscriptions. Existing cell/snapshot values remain. |
| [RefreshDashboardAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshdashboardasync-method/llms-full.txt) | Refreshes a direct dashboard source with no worksheet. Persists only logical IDs and name. Source registration and transient replacement share one workbook batch. Failures retain previous data. |
| [RefreshRangeAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshrangeasync-method/llms-full.txt) | Replaces a fixed owned rectangle, optionally including column headers. Usable for a whole table range. Column count must match; excess rows fail before writing. Unused trailing rows are cleared to prevent stale totals. Formulas outside the rectangle are preserved. Table structure/size is retained. Target must belong to this workbook. |

### Examples

Create a working report from bounded HTTP sales data. Supply an application-owned HttpClient and service URL; scope cached data to its actual audience.

```csharp
using System.Net.Http;
using TXTextControl.TXSheetControl.Data;
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> BuildWorkbookDataBindingExampleAsync(ServerSheetControl control, HttpClient client, Uri serviceBase)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    var source = new HttpDataSource(client, request => new HttpRequestMessage(HttpMethod.Get, new Uri(serviceBase, "sales?offset=" + request.Offset + "&limit=" + request.Limit)), ["Region", "Revenue"]);
    var registry = new DataSourceRegistry();
    registry.Register("sales-service", "regional-sales", source);

    var request = new DataRequest { Offset = 0, Limit = 100, Parameters = new Dictionary<string, object?> { ["year"] = 2026 } };
    var options = new DataQueryOptions { Timeout = TimeSpan.FromSeconds(15), CacheDuration = TimeSpan.FromMinutes(1), CacheScope = "public-regional-sales" };
    using var binding = new WorkbookDataBinding(book, registry);
    await binding.RefreshRangeAsync(sheet.Range("A1:B101"), "sales-service", "regional-sales", request, options);
    await sheet.Range("A1:B1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    return await control.SaveAsync(StreamType.PDF);
}
```

### See Also

- [TXTextControl.TXSheetControl.Data Namespace](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [WorkbookDataBinding Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/constructor/llms-full.txt): WorkbookDataBinding constructor in the TX Sheet Control .NET API: Creates a bridge for one workbook. Includes the syntax and a C# example.
- [WorkbookDataBinding.Dispose Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/dispose-method/llms-full.txt): WorkbookDataBinding.Dispose method in the TX Sheet Control .NET API: Cancels all in-flight refreshes and releases event subscriptions.
- [WorkbookDataBinding.RefreshDashboardAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshdashboardasync-method/llms-full.txt): WorkbookDataBinding.RefreshDashboardAsync method in the TX Sheet Control .NET API: Refreshes a direct dashboard source with no worksheet.
- [WorkbookDataBinding.RefreshRangeAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshrangeasync-method/llms-full.txt): WorkbookDataBinding.RefreshRangeAsync method in the TX Sheet Control .NET API: Replaces a fixed owned rectangle, optionally including column headers.

---

## Nearby

- **Previous:** [IDataSource.QueryAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/idatasource/queryasync-method/llms-full.txt)
- **Next:** [WorkbookDataBinding Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/constructor/llms-full.txt)
