[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.CsvOpenOptions

CsvOpenOptions Class

Represents options for opening a CSV file.

Use this class to configure how CSV content is interpreted when it is opened, including column, row, and cell separators, encoding, numeric and date conversion, formula recognition, parsed-value styling, and a custom ICsvParser.

Inheritance
CsvOpenOptions
Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public class CsvOpenOptions : OpenOptionsBase
Public Class CsvOpenOptions
    Inherits OpenOptionsBase
Examples
byte[] csvBytes = Encoding.UTF8.GetBytes("Name,Value\r\nTest,001");
using MemoryStream stream = new MemoryStream(csvBytes);
CsvOpenOptions options = new CsvOpenOptions();
options.ColumnSeparator = ",";
options.ConvertNumericData = false;
workbook.Open(stream, options);
object cellValue = workbook.Worksheets[0].Range["B2"].Value;

Constructors

Name Description
CsvOpenOptions()

Constructor.

Properties

Name Description
CellSeparator

Gets or sets the quote character used to enclose quoted cell text in CSV content.

The default value is '"'.

ColumnSeparator

Gets or sets the column separator used when opening CSV data.

The column separator determines how fields are split in each row when a CSV file is opened. The default value is ",".

ConvertDateTimeData

Gets or sets a value that indicates whether strings in a CSV text file are converted to date data when the file is opened.

The default value is true. When this property is true, text that can be recognized as date or time data is converted during CSV import.

ConvertNumericData

Gets or sets a value that indicates whether strings in a CSV text file are converted to numeric data when the file is opened.

The default value is true. When this property is true, text that can be recognized as numeric data is converted during CSV import.

Encoding

Gets or sets the default encoding used to open a CSV file.

The default value is UTF-8.

HasFormula

Gets or sets a value indicating whether text that starts with "=" is treated as a formula when a CSV file is opened.

The default value is true.

ParseStyle

Gets or sets whether styles are applied to parsed values when string values are converted to numbers or date/time values.

The default value is true.

Parser

Gets or sets a custom parser used when opening CSV content.

The parser is called for each parsed CSV cell and can inspect the original text or modify the imported value and number format.

RowSeparator

Gets or sets the row separator used when opening a CSV file.

The row separator is the string delimiter that separates records in the source CSV data.

SeparatorString

Gets or sets the column separator string used when opening a CSV file.

This property is obsolete. Use ColumnSeparator instead.