Back to Devexpress

Formatting.NumberFormatLocal Property

officefileapi-devexpress-dot-spreadsheet-dot-formatting-d1a95ee0.md

latest3.2 KB
Original Source

Formatting.NumberFormatLocal Property

Specifies a number format for a numeric cell value based on the current (local) culture.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
string NumberFormatLocal { get; set; }
vb
Property NumberFormatLocal As String

Property Value

TypeDescription
String

The local number format.

|

Remarks

The Spreadsheet uses Microsoft Excel number formats to display cell numbers as percentage, decimal, currency, accounting, and date/time values.

The NumberFormatLocal property allows you to obtain or specify a number format based on the local culture defined by the DocumentOptions.Culture property.

csharp
using DevExpress.Spreadsheet;
using System;
using System.Globalization;
// ...

// Change culture for the Spreadsheet control.
spreadsheetControl1.Options.Culture = new CultureInfo("fr-FR");

// Create a cell and set its value.
CellRange cell = worksheet.Range["A1"];
cell.Value = DateTime.Now;

// Apply a date format to the cell in the invariant culture.
cell.NumberFormat = "mm-dd-yy";
// Obtain the applied date format in the French culture.
// The returned value is "jj/mm/aaaa".
string localFormat = cell.NumberFormatLocal;
vb
Imports DevExpress.Spreadsheet
Imports System
Imports System.Globalization
' ...

' Change culture for the Spreadsheet control.
spreadsheetControl1.Options.Culture = New CultureInfo("fr-FR")

' Create a cell and set its value.
Dim cell As CellRange = worksheet.Range("A1")
cell.Value = DateTime.Now

' Apply a date format to the cell in the invariant culture.
cell.NumberFormat = "mm-dd-yy"
' Obtain the applied date format in the French culture.
' The returned value is "jj/mm/aaaa".
Dim localFormat As String = cell.NumberFormatLocal

Use the Formatting.NumberFormat option to obtain or specify a cell number format in the invariant culture.

See Also

NumberFormat

Formatting Interface

Formatting Members

DevExpress.Spreadsheet Namespace