TX Sheet Control

AnalyticsSource Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as 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

ConstructorDescription
Constructor

Properties

PropertyDescription
ConnectionIdLogical server connection ID; credentials and query text are never stored here.
HasHeaderRowHasHeaderRow value; validation is applied by the owning workbook operation.
IdId value; validation is applied by the owning workbook operation.
NameName value; validation is applied by the owning workbook operation.
NamedRangeNamedRange value; validation is applied by the owning workbook operation.
QueryIdServer-registered query ID, resolved by the optional data package.
RangeRange value; validation is applied by the owning workbook operation.
SheetIdWorksheet identity for worksheet bindings; omitted for direct connector sources.
TableIdTableId 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?[][]
    {
        ["Region", "Revenue"], ["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);
}

See Also