Table of Contents

Class CsvDataProvider

Namespace
combit.Reporting.DataProviders
Assembly
combit.ListLabel31.CrossPlatform.dll

Provides data from CSV files.

[Serializable]
public sealed class CsvDataProvider : IDataProvider, IDisposable, ISerializable
Inheritance
CsvDataProvider
Implements
Inherited Members

Remarks

This provider supports both file-based and stream-based CSV data sources. It implements IDataProvider, IDisposable, ISerializable, and combit.Reporting.DataProviders.ISupportsParameters.

Constructors

CsvDataProvider(Stream, bool, string, char, int, bool)

Initializes a new instance of the CsvDataProvider class using a stream.

public CsvDataProvider(Stream stream, bool firstLineIsHeader = true, string tableName = "", char separator = ',', int linesToSkip = 0, bool supportsCount = true)

Parameters

stream Stream

The stream containing CSV data.

firstLineIsHeader bool

A value indicating whether the first line of the CSV contains header information.

tableName string

The name of the table to be created from the CSV data.

separator char

The field separator character.

linesToSkip int

The number of initial lines to skip in the CSV data.

supportsCount bool

A value indicating whether row count is supported.

CsvDataProvider(string, bool, string, char, int, bool, ProvideFileName?)

Initializes a new instance of the CsvDataProvider class using a file name.

public CsvDataProvider(string fileName, bool firstLineIsHeader = true, string tableName = "", char separator = ',', int linesToSkip = 0, bool supportsCount = true, CsvDataProvider.ProvideFileName? provideFileName = null)

Parameters

fileName string

The file name of the CSV data source.

firstLineIsHeader bool

A value indicating whether the first line of the CSV contains header information.

tableName string

The name of the table to be created from the CSV data.

separator char

The field separator character.

linesToSkip int

The number of initial lines to skip in the CSV data.

supportsCount bool

A value indicating whether row count is supported.

provideFileName CsvDataProvider.ProvideFileName

An optional delegate to process or override the file name.

Exceptions

ListLabelException

Thrown if parameter bindings are used and the table name is not provided.

Properties

ContentEncoding

Gets or sets the content encoding used when reading the CSV data.

public Encoding ContentEncoding { get; set; }

Property Value

Encoding

FileName

Gets or the file name of the CSV data source.

public string FileName { get; }

Property Value

string

FirstLineIsHeader

Gets or sets a value indicating whether the first line of the CSV contains header information.

public bool FirstLineIsHeader { get; set; }

Property Value

bool

FramingCharacter

Gets or sets the framing (or quote) character used in the CSV.

public char FramingCharacter { get; set; }

Property Value

char

IsNewLineAllowedInQuotedField

Gets or sets a value indicating whether a new line is allowed in a quoted field.

public bool IsNewLineAllowedInQuotedField { get; set; }

Property Value

bool

LinesToSkip

Gets or sets the number of lines to skip at the beginning of the CSV file.

public int LinesToSkip { get; set; }

Property Value

int

Separator

Gets or sets the character used to separate fields in the CSV.

public char Separator { get; set; }

Property Value

char

SupportsCount

Gets or sets a value indicating whether counting the number of rows is supported.

public bool SupportsCount { get; set; }

Property Value

bool

TableName

Gets or sets the table name for the CSV data.

public string TableName { get; set; }

Property Value

string

Methods

Dispose()

Releases all resources used by the CsvDataProvider.

public void Dispose()

~CsvDataProvider()

Finalizes an instance of the CsvDataProvider class.

protected ~CsvDataProvider()