AnalyticsSource 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
A worksheet table/name/range binding or a logical server connector query without a worksheet.
Syntax
public class AnalyticsSource
Members
Constructors
| Constructor | Description |
|---|---|
| Constructor |
Properties
| Property | Description |
|---|---|
| ConnectionId | Logical server connection ID; credentials and query text are never stored here. |
| HasHeaderRow | HasHeaderRow value; validation is applied by the owning workbook operation. |
| Id | Id value; validation is applied by the owning workbook operation. |
| Name | Name value; validation is applied by the owning workbook operation. |
| NamedRange | NamedRange value; validation is applied by the owning workbook operation. |
| QueryId | Server-registered query ID, resolved by the optional data package. |
| Range | Range value; validation is applied by the owning workbook operation. |
| SheetId | Worksheet identity for worksheet bindings; omitted for direct connector sources. |
| TableId | TableId value; validation is applied by the owning workbook operation. |
Examples
Apply AnalyticsSource to a small working document, then return the exported bytes. The caller can save or download the result.
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> CreateAnalyticsSourceReportAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Range("A1:B5").SetValuesAsync(new object?[][]
{
[], ["North", 42000], ["South", 38500], ["East", 31200], ["West", 44900]
});
var settings = new AnalyticsSource()
{
HasHeaderRow = true,
Id = "sales",
Name = "Regional sales",
Range = "A1:B5",
SheetId = sheet.Id
};
await book.Analytics.SetSourceAsync(settings);
return await control.SaveAsync(StreamType.InternalWorkbookFormat);
}