

Calling particular form of SetFile results in the call of corresponding TStreamReader constructor when TnvvCSVFileReader instantiates TStreamReader internally to actually read the file. Those methods correspond to three overloaded constructors of TStreamReader with the same sets of parameters.

Field separator by default is comma (0x2C) but virtually any (Unicode) character can be used, for example, TAB, etc.Number of fields is auto-detected (by default) on the base of the first record or must be set explicitly if auto-detection is off.Empty lines can be ignored (by default, they are not ignored).Presence of header in the very first record of file is controlled by boolean property HeaderPresent.This situation can nonetheless be handled by setting property IgnoreEmptyLines to true. Consequently, the pair will result in an empty line.

Supports three kinds of line delimiters:, and, all of which can be present in the same CSV file simultaneously.
#DELPHI READ EXCEL FILE CODE#
They introduce additional “CSV source” related properties and override the abstract method that returns instance of specific TTextReader descendant:Ĭopy Code function CreateDataSourceReader: TTextReader virtual abstract Ĭlasses for other CSV data sources can be created in a similar way. TnvvCSVFileReader and TnvvCSVStringReader accept file and string as data sources respectively. They are very simple to use and have properties that allow handling number of existing variations of CSV and “CSV-like” formats.Ĭlasses are derived from abstract TnvvCSVReader class that does not specify data source and instead works with instance of TTextReader class. TnvvCSVFileReader and TnvvCSVStringReader are light weighted and fast classes that resemble unidirectional data set. Performance related notes are in "History" section below. Differences are explained in the section "Notable difference between Delphi and C# CSV Reader classes" below. Version 2.0 update: Version 2.0 significantly improves performance and adds encoding control to TnvvCSVFileReader, which resulted in slight modification of public interfaces of base TnvvCSVReader (minor change) and derived TnvvCSVFileReader (more significant change) classes comparing to version 1.0. Below, I will outline the CSV Reader features and will also provide the information related to Delphi code use. It is recommended to read that article first since I am not going to repeat everything here even though there are some minor differences like variable types, etc., but the relation between Delphi and C# specifics is obvious. All said in that article is also true in this case.
#DELPHI READ EXCEL FILE DOWNLOAD#
