Articles in this section

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

Formatting


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


//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;
'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

The screenshot below illustrates the Excel-like Formatting in GridControl.

 

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)
Access denied
Access denied