TX Sheet Control

JsonSaveOptions 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
Inherits
  1. SaveOptions
  2. TabularSaveOptions
  3. JsonSaveOptions

JSON output contains a record array or all selected rows as arrays; no workbook metadata is written.

Syntax

public class JsonSaveOptions

Members

Constructors

ConstructorDescription
Constructor

Properties

PropertyDescription
Formatrecords (default) uses header keys; rows writes all selected rows as arrays.
PrettyIndent JSON by two spaces; defaults to false.

Examples

Import customer orders, configure bounded tabular exchange and export the processed values or a formatted workbook.

using TXTextControl.TXSheetControl.Server;

async Task<byte[]> ExchangeOrderDataAsync(ServerSheetControl control)
{
    await control.LoadTextAsync("Customer;Amount;Total\nMüller;125,5;0", StreamType.CSV, new CsvLoadOptions {Delimiter=";",DecimalSeparator=",",SheetName="Orders"});

    var sheet=await control.Workbook.Sheets.AtAsync(0);
    await sheet.Cell("C2").SetFormulaAsync("=B2*1.19");
    return await control.SaveAsync(StreamType.JSON, new JsonSaveOptions { SheetName = "Orders", Range = "A1:C2", HasHeaderRow = true, MaxCells = 10000, MaxFileBytes = 1048576, Format = "records", Pretty = true });
}

See Also