DataSnapshot Class
- Namespace
TXTextControl.TXSheetControl. Data
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Data. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
Immutable detached schema and rows, serializable as a browser data response. At most 256 columns / 250,000 cells.
Syntax
public class DataSnapshot
Members
Constructors
| Constructor | Description |
|---|---|
| Constructor | Validates and detaches all input. Rejects nested values, duplicate headers, nonfinite or unsafe integers. |
Properties
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.
using TXTextControl.TXSheetControl.Data;
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> BuildDataSnapshotExampleAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
var data = new DataSnapshot(["Region", "Revenue"], [["North", 42000], ["South", 38500]]);
await sheet.Range("A1:B1").SetValuesAsync([data.Columns.Cast<object?>().ToArray()]);
await sheet.Range("A2:B3").SetValuesAsync(data.Rows.Select(row => row.ToArray()).ToArray());
await sheet.Tables.AddAsync("RegionalSales", "A1:B3", new TableOptions { Style = "TableStyleMedium2", ShowRowStripes = true });
return await control.SaveAsync(StreamType.PDF);
}