TX Sheet Control

CsvLoadOptions 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. LoadOptions
  2. TabularLoadOptions
  3. CsvLoadOptions

CSV import uses double-quote escaping and accepts CRLF, LF or CR record endings.

Syntax

public class CsvLoadOptions

Members

Constructors

ConstructorDescription
Constructor

Properties

PropertyDescription
DecimalSeparatorDecimal separator used by inference: period (default) or comma. Thousands separators are not inferred.
DelimiterOne non-quote, non-newline delimiter; defaults to comma. Semicolon and tab are supported.

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\nMüller;125,5", StreamType.CSV, new CsvLoadOptions { SheetName = "Orders", InferTypes = true, MaxFileBytes = 1048576, MaxRows = 1000, MaxColumns = 20, MaxCells = 20000, Delimiter = ";", DecimalSeparator = "," });

    var sheet=await control.Workbook.Sheets.AtAsync(0);
    await sheet.Range("A1:B1").FormatAsync(new { bold=true });
    return await control.SaveAsync(StreamType.SpreadsheetML);
}

See Also