Articles in this section
Category / Section

How to implement an excel accounting format in the syncfusion WinForms GridControl?

1 min read

Formatting

In order to implement excel like account formatting options in grid control, you can make use of CurrencySymbols, CurrencyDecimalDigits property to set currency symbols and decimal digits. Alignment of text in the grid can be changed by using HorizontalAlignment property.

C#

//To remove currency symbol
gridControl1[row, col].CurrencyEdit.CurrencySymbol = "";
gridControl1[row, col].CurrencyEdit.CurrencySymbol = "";
 
//To change currency decimal digits
gridControl1[row, col].CurrencyEdit.CurrencyDecimalDigits = 2;
gridControl1[row, col].CurrencyEdit.CurrencyDecimalDigits = 3;
            
//To change alignment
gridControl1.ColStyles[col].HorizontalAlignment = GridHorizontalAlignment.Right;
gridControl1.ColStyles[col].HorizontalAlignment = GridHorizontalAlignment.Center;

 

VB

'To remove currency symbol
gridControl1(row, col).CurrencyEdit.CurrencySymbol = ""
gridControl1(row, col).CurrencyEdit.CurrencySymbol = ""
 
'To change currency decimal digits
gridControl1(row, col).CurrencyEdit.CurrencyDecimalDigits = 2
gridControl1(row, col).CurrencyEdit.CurrencyDecimalDigits = 3
 
'To change alignment
gridControl1.ColStyles(col).HorizontalAlignment = GridHorizontalAlignment.Right
gridControl1.ColStyles(col).HorizontalAlignment = GridHorizontalAlignment.Center
 

 

Screenshot

Applied account formatting into all grid cell

 

Samples:

C#: Excel_like_Account_formatting_CS

VB Excel_like_Account_formatting_VB

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied