CsvLoadOptions Class
Represents options for loading from Character Separated Values file format.
public sealed class CsvLoadOptions : LoadOptions
Public NotInheritable Class CsvLoadOptions
Inherits LoadOptions
- Inheritance:
- System.ObjectCsvLoadOptions
Constructors
CsvLoadOptions(CsvType)
Initializes a new instance of the CsvLoadOptions class.
Parameters
CsvLoadOptions(Char)
Initializes a new instance of the CsvLoadOptions class.
Parameters
separator
- System.Char
Character that will serve as value delimiter.
Properties
AllowNewLineInQuotes
Gets or sets a value indicating whether a new line character can be inside quotes. Default value is true.
public bool AllowNewLineInQuotes { get; set; }
Public Property AllowNewLineInQuotes As Boolean
Property Value
- System.Boolean
DateTimeFormats
Gets or sets an list of formats to be used when parsing cell values to System.DateTime (provided that ParseDates is true).
public IList<string> DateTimeFormats { get; set; }
Public Property DateTimeFormats As IList(Of String)
Property Value
- System.Collections.Generic.IList<System.String>
Remarks
If this list is empty and ParseDates is set to true, texts will be converted to System.DateTime values when they are in one of the default formats supported by System.DateTime.TryParse(System.String,System.IFormatProvider,System.Globalization.DateTimeStyles,System.DateTime@).
By default, this list is pre-filled with the following formats:
"d-M-yyyy" | "d-M-yyyy HH:mm" | "d-M-yyyy HH:mm:ss" |
"dd-MM-yyyy" | "dd-MM-yyyy HH:mm" | "dd-MM-yyyy HH:mm:ss" |
"M-d-yyyy" | "M-d-yyyy HH:mm" | "M-d-yyyy HH:mm:ss" |
"MM-dd-yyyy" | "MM-dd-yyyy HH:mm" | "MM-dd-yyyy HH:mm:ss" |
"yyyy-M-d" | "yyyy-M-d HH:mm" | "yyyy-M-d HH:mm:ss" |
"yyyy-MM-dd" | "yyyy-MM-dd HH:mm" | "yyyy-MM-dd HH:mm:ss" |
"d/M/yyyy" | "d/M/yyyy HH:mm" | "d/M/yyyy HH:mm:ss" |
"dd/MM/yyyy" | "dd/MM/yyyy HH:mm" | "dd/MM/yyyy HH:mm:ss" |
"M/d/yyyy" | "M/d/yyyy HH:mm" | "M/d/yyyy HH:mm:ss" |
"MM/dd/yyyy" | "MM/dd/yyyy HH:mm" | "MM/dd/yyyy HH:mm:ss" |
"yyyy/M/d" | "yyyy/M/d HH:mm" | "yyyy/M/d HH:mm:ss" |
"yyyy/MM/dd" | "yyyy/MM/dd HH:mm" | "yyyy/MM/dd HH:mm:ss" |
DateTimeStyles
Gets or sets a value indicating DateTime styles permitted in strings when parsing them to DateTimes. Default value is System.Globalization.DateTimeStyles.None.
public DateTimeStyles DateTimeStyles { get; set; }
Public Property DateTimeStyles As DateTimeStyles
Property Value
- System.Globalization.DateTimeStyles
Encoding
Gets or sets the encoding for the CSV file.
Property Value
- System.Text.Encoding
Exceptions
- System.ArgumentNullException
Value is set to null.
HasFormulas
Gets or sets a value indicating the text is formula if it starts with '='. Default value is false.
Property Value
- System.Boolean
HasQuotedValues
Gets or sets a value indicating whether values in CSV file can be quoted. Default value is true.
Property Value
- System.Boolean
NumberStyles
Gets or sets a value indicating number styles permitted in strings when parsing them to numeric types.
Property Value
- System.Globalization.NumberStyles
ParseDates
Gets or sets a value indicating whether dates will be parsed and stored as System.DateTime values when loading a CSV file. If false, numbers will be loaded as strings. Default value is true.
Property Value
- System.Boolean
ParseFormatProvider
Gets or sets the format provider for the CSV file.
public IFormatProvider ParseFormatProvider { get; set; }
Public Property ParseFormatProvider As IFormatProvider
Property Value
- System.IFormatProvider
Exceptions
- System.ArgumentNullException
Value is set to null.
ParseNumbers
Gets or sets a value indicating whether numbers will be parsed and stored as System.Double values when loading CSV file. If false, numbers will be loaded as strings. Default value is true.
Property Value
- System.Boolean
Separator
Gets or sets character that serves as value delimiter.
Property Value
- System.Char
Exceptions
- System.ArgumentException
Value is set to quote '"' or new line '\n'.
StreamingMode
Gets or sets the streaming mode that allows streamlined reading of ExcelRows of each ExcelWorksheet of a loaded ExcelFile.
Default value: None.
public LoadStreamingMode StreamingMode { get; set; }
Public Property StreamingMode As LoadStreamingMode
Property Value
The streaming mode.
Type
Gets or sets value delimiter type, see CsvType.
Property Value
- System.Nullable<CsvType>
Exceptions
- System.ArgumentNullException
Value is set to null.
Inherited Properties
CsvDefault | Gets the default options for loading from Character Separated Values file format. (Inherited from LoadOptions) |
HtmlDefault | Gets the default options for loading from HyperText Markup Language File (HTML) format. (Inherited from LoadOptions) |
OdsDefault | Gets the default options for loading from OpenDocument Spreadsheet file format. (Inherited from LoadOptions) |
TxtDefault | Gets the default options for loading from Tab delimited file format. (Inherited from LoadOptions) |
XlsDefault | Gets the default options for loading from XLS file format (Microsoft Excel Spreadsheet format; Excel 2003 and prior versions) . (Inherited from LoadOptions) |
XlsbDefault | Gets the default options for loading from XLSX file format (Microsoft Excel Binary File Format). (Inherited from LoadOptions) |
XlsxDefault | Gets the default options for loading from XLSX file format (Microsoft Excel Open XML Spreadsheet; Excel 2007 and later). (Inherited from LoadOptions) |
XmlDefault | Gets the default options for loading from XML file format (XML Spreadsheet 2003). (Inherited from LoadOptions) |