API Reference

Class

CsvLoadOptions

Namespace OfficeIMO.CSV
Assembly OfficeIMO.CSV
Modifiers sealed

Options controlling how CSV content is parsed and loaded.

Inheritance

  • Object
  • CsvLoadOptions

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by

Accepted by parameters

Constructors

public CsvLoadOptions() #

Methods

public CsvLoadOptions Clone() #
Returns: CsvLoadOptions

Creates an options copy with mutable collections snapshotted for deferred reads.

Properties

public Boolean HasHeaderRow { get; set; } #

Gets or sets whether the first record in the file represents the header row. Default is true. Ignored when Header is provided; in that case the first record is treated as data.

public String[] Header { get; set; } #

Gets or sets explicit header names to use for the CSV data. When provided, no input row is consumed as the header.

public Int32 SkipInitialRecords { get; set; } #

Gets or sets the number of parsed records to skip before header discovery or data emission. Default is 0.

public Boolean SkipCommentRowsBeforeHeader { get; set; } #

Gets or sets whether comment rows are skipped while discovering the header. Default is true. Comment rows are identified by CommentCharacter.

public Boolean SkipCommentRows { get; set; } #

Gets or sets whether comment rows are skipped throughout the file. Default is false. Comment rows are identified by CommentCharacter.

public Int32 MaxCommentContinuationLines { get; set; } #

Gets or sets the maximum number of physical continuation lines inspected for a quoted comment record. Once the limit is reached, buffered lines are replayed as ordinary input instead of being retained while searching for a closing quote. Defaults to DefaultMaxCommentContinuationLines.

public Char CommentCharacter { get; set; } #

Gets or sets the character that identifies a comment row when it appears at the start of a record. Default is #.

public Boolean RecognizeW3CFieldsHeader { get; set; } #

Gets or sets whether W3C Extended Log File Format #Fields: rows are recognized as headers. Default is true.

public Boolean GenerateMissingHeaderNames { get; set; } #

Gets or sets whether blank header names are replaced with generated names such as H1. Default is true.

public CsvDuplicateHeaderBehavior DuplicateHeaderBehavior { get; set; } #

Gets or sets how duplicate header names are handled. Default renames duplicate headers to keep name-based row access unambiguous.

public String NullValue { get; set; } #

Gets or sets a token that should be materialized as null when loading rows into a CsvDocument. Raw string streaming callbacks preserve the source text.

public String[] DateTimeFormats { get; set; } #

Gets or sets additional date/time formats used by typed row conversion and schema validation.

public DataMappingErrorValuePolicy MappingErrorValuePolicy { get; set; } #

Gets or sets whether schema and row-mapping failures may include source values. Defaults to Include for compatibility.

public CsvQuoteParsingMode QuoteParsingMode { get; set; } #

Gets or sets how malformed quoted fields are handled. Default is Lenient to preserve common PowerShell-style import behavior.

public IReadOnlyDictionary<String, Object> StaticColumns { get; set; } #

Gets or sets columns appended to every loaded row, useful for source file names, import timestamps, or batch metadata.

public CsvColumnCountMismatchPolicy ColumnCountMismatchPolicy { get; set; } #

Gets or sets how parsed records are handled when their field count differs from the header count. Default pads missing fields and ignores extras, matching common PowerShell CSV import behavior.

public Char Delimiter { get; set; } #

Gets or sets the field delimiter character. Default is ,.

public String DelimiterText { get; set; } #

Gets or sets the field delimiter text. Leave unset to use Delimiter. Single-character values keep the optimized character delimiter path; longer values enable flexible delimiter parsing.

public Boolean DetectDelimiter { get; set; } #

Gets or sets whether the delimiter should be detected from the first meaningful records. Detection is opt-in and leaves Delimiter unchanged when no candidate clearly fits.

public Char[] DelimiterCandidates { get; set; } #

Gets or sets delimiter candidates used when DetectDelimiter is enabled. Defaults to comma, semicolon, pipe, and tab.

public Boolean TrimWhitespace { get; set; } #

Gets or sets whether leading and trailing whitespace should be trimmed from unquoted fields. Default is false.

public CultureInfo Culture { get; set; } #

Gets or sets the culture used for type conversions when reading. Defaults to InvariantCulture.

public Boolean AllowEmptyLines { get; set; } #

Gets or sets whether empty lines should be preserved. Default is false (empty lines are ignored).

public Encoding Encoding { get; set; } #

Gets or sets the text encoding to use when reading from files. Defaults to UTF-8 if not provided.

public CsvCompressionType CompressionType { get; set; } #

Gets or sets compression used when reading from files. Default infers compression from the file extension.

public Nullable<Int64> MaxDecompressedBytes { get; set; } #

Gets or sets an optional limit for decompressed bytes read from compressed CSV files. Defaults to 256 MiB. Set to null only for trusted inputs that intentionally exceed the limit.

public Int64 MaxInputBytes { get; set; } #

Gets or sets the maximum number of bytes accepted by stream-based and uncompressed path-based load APIs. Defaults to 256 MiB so untrusted inputs cannot be buffered without bound.

public CancellationToken CancellationToken { get; set; } #

Gets or sets an optional cancellation token checked while reading records.

public Int32 ProgressReportInterval { get; set; } #

Gets or sets how often ProgressCallback is called, in emitted records. Default is 0, which disables progress callbacks.

public Action<CsvProgress> ProgressCallback { get; set; } #

Gets or sets an optional callback invoked as records are emitted.

public Boolean CollectParseErrors { get; set; } #

Gets or sets whether parse errors should be collected into ParseErrors.

public CsvParseErrorAction ParseErrorAction { get; set; } #

Gets or sets how parse errors are handled. Default throws immediately.

public Int32 MaxParseErrors { get; set; } #

Gets or sets the maximum number of collected parse errors before parsing fails. Default is 100.

public IList<CsvParseError> ParseErrors { get; set; } #

Gets or sets the collection receiving parse errors when CollectParseErrors is enabled.

public Nullable<Int32> MaxFieldLength { get; set; } #

Gets or sets an optional maximum length for any parsed field.

public Nullable<Int32> MaxQuotedFieldLength { get; set; } #

Gets or sets an optional maximum length for fields parsed from quoted records.

public Boolean NormalizeQuotes { get; set; } #

Gets or sets whether curly quote characters are normalized to straight quotes while reading.

public Boolean InternStrings { get; set; } #

Gets or sets whether repeated string values are reused through a per-read string cache.

Fields

public const Int64 DefaultMaxInputBytes #

Default maximum complete stream input size (256 MiB).

Value: 268435456
public const Int32 DefaultMaxCommentContinuationLines #

Default maximum physical lines inspected while deciding whether a quoted comment continues.

Value: 64