ReoGrid formats cell display and parsing through data formatters. Supported format types include numbers, dates, percent, currency, text, and custom formatters.
Namespace
using unvell.ReoGrid.DataFormat;
Applying Data Formats
Use SetRangeDataFormat on the worksheet:
var sheet = reoGridControl.CurrentWorksheet;
sheet.SetRangeDataFormat("A1:B2", CellDataFormatFlag.Number,
new NumberDataFormatter.NumberFormatArgs
{
DecimalPlaces = 4,
NegativeStyle = NumberDataFormatter.NumberNegativeStyle.RedBrackets,
UseSeparator = true,
});
With undo support:
reoGridControl.DoAction(new SetRangeDataFormatAction("A1:B2",
CellDataFormatFlag.Number,
new NumberDataFormatter.NumberFormatArgs { DecimalPlaces = 2 }));
Quick test:
sheet["B2"] = 12345;
sheet["C2"] = 12345.67890;
sheet["B3"] = -1234;
sheet["C3"] = -1234.56789;

CellDataFormatFlag Enum
| Value | Description | Argument Type |
|---|---|---|
General | Auto format (text and number) | None |
Number | Numeric formatting | NumberDataFormatter.NumberFormatArgs |
DateTime | Date and time formatting | DateTimeDataFormatter.DateTimeFormatArgs |
Percent | Percentage formatting | NumberDataFormatter.NumberFormatArgs |
Currency | Currency formatting | CurrencyDataFormatter.CurrencyFormatArgs |
Text | Plain text (no formatting) | None |
Custom | Custom data formatter | Any object |
Number Format
Number format supports thousands separators, decimal places, and negative number styles.

sheet.SetRangeDataFormat("A1:E7", CellDataFormatFlag.Number,
new NumberDataFormatter.NumberFormatArgs
{
DecimalPlaces = 4,
UseSeparator = true,
});
NumberFormatArgs Properties
| Property | Type | Default | Description |
|---|---|---|---|
DecimalPlaces | short | 2 | Number of decimal places to display |
UseSeparator | bool | false | Show thousands separator |
NegativeStyle | NumberNegativeStyle | Minus | How to display negative numbers |
CustomNegativePrefix | string | null | Custom prefix for negative numbers (used with CustomSymbol style) |
CustomNegativePostfix | string | null | Custom postfix for negative numbers (used with CustomSymbol style) |
NumberNegativeStyle Enum (Flags)
| Style | Value | Example | Description |
|---|---|---|---|
Minus (Default) | 0x1 | -123,456.789 | Regular minus sign |
Red | 0x2 | 123,456.789 | Red text, no minus |
Brackets | 0x4 | (123,456.789) | Surrounded by brackets |
RedMinus | 0x3 | -123,456.789 | Red text with minus |
BracketsMinus | 0x5 | (-123,456.789) | Brackets with minus |
RedBrackets | 0x6 | (123,456.789) | Red text in brackets |
RedBracketsMinus | 0x7 | (-123,456.789) | Red, brackets, and minus |
Prefix_Sankaku | 0x8 | โฒ 123,456.789 | Japanese triangle prefix |
CustomSymbol | 0xf0 | โ | Use CustomNegativePrefix / CustomNegativePostfix |
This is a flags enum โ values can be combined with |:
NegativeStyle = NumberDataFormatter.NumberNegativeStyle.Brackets | NumberDataFormatter.NumberNegativeStyle.Red
Negative Number Example

sheet.SetRangeDataFormat("B2", CellDataFormatFlag.Number,
new NumberDataFormatter.NumberFormatArgs
{
DecimalPlaces = 3,
NegativeStyle = NumberDataFormatter.NumberNegativeStyle.RedBrackets,
UseSeparator = true,
});
sheet["B2"] = -12345.67;
DateTime Format
Specify a culture and format pattern using standard .NET datetime patterns:

sheet.SetRangeDataFormat(RangePosition.EntireRange, CellDataFormatFlag.DateTime,
new DateTimeDataFormatter.DateTimeFormatArgs
{
CultureName = "en-US",
Format = "yyyy/MM/dd",
});
DateTimeFormatArgs Properties
| Property | Type | Default | Description |
|---|---|---|---|
Format | string | null | .NET datetime format pattern (e.g., "yyyy/MM/dd", "MM/dd/yyyy HH:mm") |
CultureName | string | null | Culture name for localization (e.g., "en-US", "ja-JP") |
Note:
DateTimeFormatArgsis astruct, not a class.
Percent Format
Values are displayed as percentages. Uses NumberFormatArgs for configuration:

sheet.SetRangeDataFormat(RangePosition.EntireRange, CellDataFormatFlag.Percent,
new NumberDataFormatter.NumberFormatArgs
{
DecimalPlaces = 2,
});
A cell value of 0.5 displays as 50.00%.
Currency Format
Currency extends number formatting with a currency symbol placed before or after the value.

sheet.SetRangeDataFormat("B2", CellDataFormatFlag.Currency,
new CurrencyDataFormatter.CurrencyFormatArgs
{
CultureEnglishName = "en-US",
DecimalPlaces = 2,
UseSeparator = true,
PrefixSymbol = "$",
});
sheet["B2"] = 1234;
CurrencyFormatArgs Properties
CurrencyFormatArgs inherits from NumberFormatArgs and adds currency-specific properties:
| Property | Type | Default | Description |
|---|---|---|---|
PrefixSymbol | string | null | Symbol placed before the number (e.g., "$", "$ ") |
PostfixSymbol | string | null | Symbol placed after the number (e.g., " USD", " ๅ") |
CultureEnglishName | string | null | Culture name (e.g., "en-US") |
DecimalPlaces | short | 2 | Number of decimal places (inherited) |
UseSeparator | bool | false | Show thousands separator (inherited) |
NegativeStyle | NumberNegativeStyle | Minus | Negative number display style (inherited) |
Prefix with Space

sheet.SetRangeDataFormat("B2", CellDataFormatFlag.Currency,
new CurrencyDataFormatter.CurrencyFormatArgs
{
CultureEnglishName = "en-US",
DecimalPlaces = 2,
UseSeparator = true,
PrefixSymbol = "$ ", // Note the trailing space
});
Postfix Symbol

sheet.SetRangeDataFormat("B2", CellDataFormatFlag.Currency,
new CurrencyDataFormatter.CurrencyFormatArgs
{
CultureEnglishName = "en-US",
DecimalPlaces = 2,
UseSeparator = true,
PostfixSymbol = " USD",
});
Text Format
Use Text to keep values as literal strings with no formatting:

sheet.SetRangeDataFormat(RangePosition.EntireRange, CellDataFormatFlag.Text, null);
Cell Data Format Properties
Access the format on individual cells:
var cell = sheet.Cells["A1"];
// Get the current format
CellDataFormatFlag format = cell.DataFormat;
object formatArgs = cell.DataFormatArgs;
// Set the format
cell.SetDataFormat(CellDataFormatFlag.Number,
new NumberDataFormatter.NumberFormatArgs { DecimalPlaces = 3 });
| Property | Type | Description |
|---|---|---|
DataFormat | CellDataFormatFlag | The cellโs data format type |
DataFormatArgs | object | Format-specific arguments |
CustomDataFormatter | IDataFormatter | Custom data formatter implementation |
Custom Data Formatter
Implement IDataFormatter to create custom formatters:
public interface IDataFormatter
{
string FormatCell(Cell cell);
bool PerformTestFormat();
}
| Method | Description |
|---|---|
FormatCell(Cell cell) | Format the cellโs data. Return a non-empty string on success, or null to skip. |
PerformTestFormat() | Return true to check data type before formatting, false to skip the check. |
Apply with CellDataFormatFlag.Custom:
sheet.SetRangeDataFormat("A1", CellDataFormatFlag.Custom, myFormatterArgs);
// Or set on a cell directly
cell.CustomDataFormatter = new MyCustomFormatter();
See Custom Data Format for detailed examples.
Related Topics
- Cell โ Cell properties and data access
- Custom Data Format โ Creating custom formatters
- Cell Editing โ Input behavior settings
- Settings โ Auto-format settings