Skip to main content

CellValueToStringConverter.PreferredCulture Property

Gets or sets the information used to format culture-specific string data.

Namespace: DevExpress.Spreadsheet.Export

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public CultureInfo PreferredCulture { get; set; }

Property Value

Type Description
CultureInfo

A CultureInfo object that provides culture-specific information.

Remarks

Use the PreferredCulture property to obtain string data in a format specific to a certain culture, or to parse text data.

The following code exports DateTime values in a format specific to French (France) culture. The result is the string “17-octobre”.

using DevExpress.Spreadsheet;
using DevExpress.Spreadsheet.Export;
using System;
using System.Data;
// ...
Worksheet worksheet = spreadsheetControl1.Document.Worksheets.ActiveWorksheet;
DataTable dataTable = new DataTable();
dataTable.Columns.Add(new DataColumn("Col1", typeof(string)));
worksheet["A1"].Value = new DateTime(2013, 10, 17);
DataTableExporter exporter = worksheet.CreateDataTableExporter(worksheet["A1"], dataTable, false);
exporter.Options.DefaultCellValueToStringConverter.SetPreferredNumberFormat(spreadsheetControl1.Document, "d-mmmm");
exporter.Options.DefaultCellValueToStringConverter.PreferredCulture = new System.Globalization.CultureInfo("fr-Fr");
exporter.Export();
string result = dataTable.Rows[0].Field<string>("Col1");
See Also