We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copy formatting cell from GridDataBoundGrid

Thread ID:





129518 Mar 23,2017 10:16 AM UTC Mar 28,2017 01:21 PM UTC WinForms 5
Tags: GridDataBoundGrid(Classic)
Asked On March 23, 2017 10:16 AM UTC


I want to copy cell from GridDataBoundGrid.

The cell format is currency.

When I select the cell it's being a text without format.

For Example : 1,000,123$ become 1000123

I want to copy the cell with the format - How can I do it?

(I upgrade VS from oldest version that it work well, in VS2015 it not work weel)/


Piruthiviraj Malaimelraj [Syncfusion]
Replied On March 24, 2017 12:55 PM UTC

Hi Elad, 

Thanks for your interest in Syncfusion products. 

We have analyzed your scenario with VS2015 and 4.6 Framework , but unfortunately we could not able to reproduce the issue at our end. Could you please provide the below details? It would be more helpful for us to provide the solution at the earliest. 

·         Ensure whether the reported issue is reproduced in attached sample. 
·         Let us know , which Syncfusion build version is you are using in your project. 
·         Let us know , if you have any customization regarding copy and paste in your sample. 
·         Please provide the simple video of your sample execution. 

Please refer to the attached video and sample, 
Sample link: 
Video link: 

Replied On March 26, 2017 08:02 AM UTC

Thank you for replying.

I tested your project and realized that the problem occurred when I changed this line
Me.gridDataBoundGrid1.Binder.InternalColumns("Description").StyleInfo.Format = "##,###$"

  Me.gridDataBoundGrid1.Binder.InternalColumns("Description").StyleInfo.CellType = "Currency"

Is there is a way to do copy and paste with format when the format setting is by CellType?

Piruthiviraj Malaimelraj [Syncfusion]
Replied On March 27, 2017 10:43 AM UTC

Hi Elad, 

Thanks for the update. 

We could able to understand your scenario. As per our Grid architecture, when the format string is set by using GridStyleInfo.Format property, the formatted text will be copy/paste properly. To avoid the reported scenario, please use anyone of the below suggestions, 
Suggestion 1: 
To paste the text with applied formats of “Currency” type columns, customize the Clipboard contents by using ClipboardCopy event. Please make use of the below code, 
Code example: 
Me.gridDataBoundGrid1.Binder.InternalColumns("Description").StyleInfo.CellType = GridCellTypeName.Currency 
AddHandler Me.gridDataBoundGrid1.Model.ClipboardCopy, AddressOf Model_ClipboardCopy 
Private Sub Model_ClipboardCopy(ByVal sender As Object, ByVal e As GridCutPasteEventArgs) 
                Dim range As GridRangeInfo = e.RangeList.ActiveRange 
                Dim text As String = String.Empty 
                Dim data As DataObject = CType(Clipboard.GetDataObject(), DataObject) 
                For row As Integer = range.Top To range.Bottom 
                                For col As Integer = range.Left To range.Right 
                                                text &= Me.gridDataBoundGrid1.Model(row, col).FormattedText 
                                                If col <> range.Right Then 
                                                                text &= Constants.vbTab 
                                                End If 
                                Next col 
                                text &= System.Environment.NewLine 
                Next row 
                Clipboard.SetDataObject(New DataObject(text)) 
                e.Handled = True 
                e.Result = True 
End Sub 
Suggestion 2: 
Set the format by using GridStyleInfo.Format property as like below code, 

Me.gridDataBoundGrid1.Binder.InternalColumns("Description").StyleInfo.Format = "##,###$" 
Me.gridDataBoundGrid1.Binder.InternalColumns("CategoryID").StyleInfo.Format = "C" 
Suggestion 3: 
Set the cell type of the columns in where you want to paste the contents also as “Currency”. 
Me.gridDataBoundGrid1.Binder.InternalColumns("Column2").StyleInfo.CellType = GridCellTypeName.Currency 
Me.gridDataBoundGrid1.Binder.InternalColumns("Column3").StyleInfo.CellType = GridCellTypeName.Currency 
Sample link: 

Replied On March 27, 2017 12:31 PM UTC

Thank you for replying.

Unfortunately, this example doesn't work for me.
When I select the cell it's being unformatted.

What is the main differences between :

  Me.gridDataBoundGrid1.Binder.InternalColumns("Description").StyleInfo.CellType = "Currency"


Me.gridDataBoundGrid1.Binder.InternalColumns("Description").StyleInfo.Format = "C" 


and why in oldest version of VS it work perfectly?

Piruthiviraj Malaimelraj [Syncfusion]
Replied On March 28, 2017 01:21 PM UTC

Hi Elad, 
Thanks for the update. 
Unfortunately, this example doesn't work for me. 
When I select the cell it's being unformatted. 
We could not able to reproduce the issue at our end. Please refer to attached video. 
Can you please provide the simple video or screenshots of replication procedure of the scenario? It would be more helpful for us to analyze further on this scenario. 
Video link:  
Difference between Currency celltype and “C” format. 
The “Currency” cell type can be used to represent monetary values to achieve accuracy in the calculations. You can customize the currency cell appearance (i.e currency symbol, decimal separator, etc..) by using GridStyleInfo. Please refer to the below UG document, 

Why in oldest version of VS it work perfectly? 
We have checked this scenario with all VS versions. But unfortunately we could not able to reproduce the issue at our end.  
·         Please ensure whether any assembly conflicts occurred in your project. 
·         Provide the Syncfusion build version details that you are using in sample. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon