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
streamStreamThe stream containing CSV data.
firstLineIsHeaderboolA value indicating whether the first line of the CSV contains header information.
tableNamestringThe name of the table to be created from the CSV data.
separatorcharThe field separator character.
linesToSkipintThe number of initial lines to skip in the CSV data.
supportsCountboolA 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
fileNamestringThe file name of the CSV data source.
firstLineIsHeaderboolA value indicating whether the first line of the CSV contains header information.
tableNamestringThe name of the table to be created from the CSV data.
separatorcharThe field separator character.
linesToSkipintThe number of initial lines to skip in the CSV data.
supportsCountboolA value indicating whether row count is supported.
provideFileNameCsvDataProvider.ProvideFileNameAn 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
FileName
Gets or the file name of the CSV data source.
public string FileName { get; }
Property Value
FirstLineIsHeader
Gets or sets a value indicating whether the first line of the CSV contains header information.
public bool FirstLineIsHeader { get; set; }
Property Value
FramingCharacter
Gets or sets the framing (or quote) character used in the CSV.
public char FramingCharacter { get; set; }
Property Value
IsNewLineAllowedInQuotedField
Gets or sets a value indicating whether a new line is allowed in a quoted field.
public bool IsNewLineAllowedInQuotedField { get; set; }
Property Value
LinesToSkip
Gets or sets the number of lines to skip at the beginning of the CSV file.
public int LinesToSkip { get; set; }
Property Value
Separator
Gets or sets the character used to separate fields in the CSV.
public char Separator { get; set; }
Property Value
SupportsCount
Gets or sets a value indicating whether counting the number of rows is supported.
public bool SupportsCount { get; set; }
Property Value
TableName
Gets or sets the table name for the CSV data.
public string TableName { get; set; }
Property Value
Methods
Dispose()
Releases all resources used by the CsvDataProvider.
public void Dispose()
~CsvDataProvider()
Finalizes an instance of the CsvDataProvider class.
protected ~CsvDataProvider()