PivotTableOptions.PreserveFormatting 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
Retain existing result-cell formatting by position on refresh unless a new pivot style is applied; default false.
Syntax
public bool? PreserveFormatting { get; init; }
Example
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 Summary");
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" }, new() { Field = "Category" }],
Values = [new() { Field = "Revenue", Caption = "Sales", NumberFormatCode = "$#,##0.00" }], Layout = "tabular"
});
await pivot.UpdateAsync(new { preserveFormatting = true });
await source.Cell("C2").SetValueAsync(1500);
await pivot.RefreshAsync();
See Pivot Tables for the options dialog, Show controls, refresh semantics and export behavior.