[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.CsvSaveOptions

CsvSaveOptions Class

Represents options for saving a workbook as a CSV file.

Use this class to configure CSV export settings such as column, row, and cell separators, text encoding, value quoting, and whether leading blank rows and columns are trimmed.

Inheritance
CsvSaveOptions
Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public class CsvSaveOptions : SaveOptionsBase
Public Class CsvSaveOptions
    Inherits SaveOptionsBase
Examples
worksheet.Range["A1:B2"].Value = new object[,]
{
    { "Name", "Value" },
    { "Test", 100 }
};
CsvSaveOptions options = new CsvSaveOptions();
options.ColumnSeparator = ";";
options.RowSeparator = "\r\n";
options.CellSeparator = '"';
options.ValueQuoteType = ValueQuoteType.Always;
workbook.Save("path/to/output.csv", options);

Constructors

Name Description
CsvSaveOptions()

Creates options for saving a workbook as a CSV file.

This constructor initializes the option object to use Csv. Configure CSV-specific settings before passing the options to a workbook save API.

Properties

Name Description
CellSeparator

Gets or sets the cell separator character used when saving CSV content.

This character is used to enclose cell text in the exported CSV data. The default value is '"'.

ColumnSeparator

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

The column separator determines how values are separated between columns in the exported CSV content.

Encoding

Gets or sets the default encoding used when saving a CSV file.

The default encoding is UTF-8.

EscapeFormulaLikeValues

Gets or sets whether CSV values that begin with formula-like characters are escaped during export.

When this property is set to true, values that start with =, +, -, @, their full-width variants, tab, carriage return, or line feed are written with a leading apostrophe. The default value is false.

QuoteColumns

Gets or sets the zero-based column indices that are configured to be quoted during CSV export.

When this property is set, only the specified columns are forced to use the cell separator as quotes, while other columns are not quoted unless required by the CSV content. Invalid column indices are preserved in this collection, but they have no effect during export.

RowSeparator

Gets or sets the row separator.

This property controls the string used to separate rows when saving a workbook to a CSV file.

SeparatorString

Gets or sets the column separator string.

This property is obsolete and returns the same value as ColumnSeparator.

TrimLeadingBlankRowAndColumn

Gets or sets whether leading blank rows and columns are trimmed when saving to CSV.

This property indicates whether leading blank rows and columns are trimmed in the same way as Microsoft Excel during CSV export. The default value is true.

ValueQuoteType

Gets or sets how values are quoted in the exported text file.

This option controls the quoting behavior used when saving CSV content. If QuoteColumns is set, this setting is ignored.