GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    CsvLoadOptions Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents options for loading from Character Separated Values file format.

    • C#
    • VB.NET
    public sealed class CsvLoadOptions : LoadOptions
    Public NotInheritable Class CsvLoadOptions
        Inherits LoadOptions
    Inheritance:
    System.Object
    LoadOptions
    CsvLoadOptions

    Constructors

    CsvLoadOptions(CsvType)

    Initializes a new instance of the CsvLoadOptions class.

    • C#
    • VB.NET
    public CsvLoadOptions(CsvType csvType)
    Public Sub New(csvType As CsvType)
    Parameters
    csvType
    CsvType

    Value delimiter, CsvType.

    CsvLoadOptions(Char)

    Initializes a new instance of the CsvLoadOptions class.

    • C#
    • VB.NET
    public CsvLoadOptions(char separator)
    Public Sub New(separator As Char)
    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.

    • C#
    • VB.NET
    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).

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public Encoding Encoding { get; set; }
    Public Property Encoding As Encoding
    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.

    • C#
    • VB.NET
    public bool HasFormulas { get; set; }
    Public Property HasFormulas As Boolean
    Property Value
    System.Boolean

    HasQuotedValues

    Gets or sets a value indicating whether values in CSV file can be quoted. Default value is true.

    • C#
    • VB.NET
    public bool HasQuotedValues { get; set; }
    Public Property HasQuotedValues As Boolean
    Property Value
    System.Boolean

    NumberStyles

    Gets or sets a value indicating number styles permitted in strings when parsing them to numeric types.

    • C#
    • VB.NET
    public NumberStyles NumberStyles { get; set; }
    Public Property NumberStyles As NumberStyles
    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.

    • C#
    • VB.NET
    public bool ParseDates { get; set; }
    Public Property ParseDates As Boolean
    Property Value
    System.Boolean

    ParseFormatProvider

    Gets or sets the format provider for the CSV file.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public bool ParseNumbers { get; set; }
    Public Property ParseNumbers As Boolean
    Property Value
    System.Boolean

    Separator

    Gets or sets character that serves as value delimiter.

    • C#
    • VB.NET
    public char Separator { get; set; }
    Public Property Separator As Char
    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.

    • C#
    • VB.NET
    public LoadStreamingMode StreamingMode { get; set; }
    Public Property StreamingMode As LoadStreamingMode
    Property Value
    LoadStreamingMode

    The streaming mode.

    Type

    Gets or sets value delimiter type, see CsvType.

    • C#
    • VB.NET
    public CsvType? Type { get; set; }
    Public Property Type As 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)

    Examples

    Convert Excel files to PDF in C# and VB.NET
    Open and read Excel file in C# and VB.NET
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.