PivotTableOptions.AutoRefresh Property
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.asTXSheetControl. Server TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Api. dll
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
Refresh the PivotTable automatically when its evaluated source observations change. The source edit and refreshed report form one undo step. The default is false.
Syntax
public bool? AutoRefresh { get; }
Example
Place this code in a .NET console application that references the server package. It creates source orders and a report before applying the setting or operation.
using TXTextControl.TXSheetControl.Server;
await using var control = new ServerSheetControl();
var workbook = control.Workbook;
var source = await workbook.Sheets.AtAsync(0);
await source.Range("A1:D5").SetValuesAsync([
[],
[], ["Europe", "Services", 700, 350],
[], ["Americas", "Services", 950, 400]
]);
var report = await workbook.Sheets.AddAsync("Sales Pivot");
var pivot = await report.PivotTables.AddAsync(new PivotTableOptions {
Name = "RegionalSales", Source = new() { SheetId = source.Id, Range = "A1:D5" },
Destination = new() { SheetId = report.Id, Cell = "B3" },
Rows = [new() { Field = "Region" }], Columns = [new() { Field = "Category" }],
Values = [new() { Field = "Revenue", Caption = "Sales", NumberFormatCode = "$#,##0.00" }]
});
await pivot.UpdateAsync(new { autoRefresh = true });
await source.Cell("C2").SetValueAsync(1500);
Automatic refresh includes source formulas whose dependencies change on another worksheet, resized source tables and named ranges whose reference is replaced. Linked PivotCharts and dependent GETPIVOTDATA formulas follow the refreshed report. A failed refresh rolls back the initiating edit.
With false, reads and exports retain the last refreshed report. Call RefreshAsync() or RefreshAllAsync() to accept pending source edits. Changing report settings through UpdateAsync() also refreshes the report.
See Pivot Tables for cache semantics, grouping, supported values and limits. Partial updates use camelCase anonymous objects; creation uses complete PivotTableOptions.