The WPF TreeGrid Control provides support for the clipboard copy and paste operations and not for ReadOnly Grid and columns. You can achieve this by changing the read only value of the Grid and Gridcell for the readonly column at runtime by using the ClipBoardPaste and ClipBoardPasted events in the GridTreeControl. Refer to the following code example to wire the ClipboardPaste and ClipboardPasted events in the GridTreeControl. C# treeGrid.Model.ClipboardPaste += Model_ClipboardPaste; treeGrid.Model.ClipboardPasted += Model_ClipboardPasted; You need to set ReadOnly as false for both Grid and Gridcell to allow the paste operation in the ClipBoardPaste event when the Grid and Gridcell have ReadOnly as true. Please refer to the following code example that illustrates this. C# void Model_ClipboardPaste(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count. for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex. var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly. if (colindex >= 0 && treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as false for a GridCell. treeGrid.Model[row, col].ReadOnly = false; } } } //Set ReadOnly as false for Grid. treeGrid.ReadOnly = false; } The ClipboardPasted event fires after pasting the data in the GridTreeControl and you can set an actual value, True, to ReadOnly property of the Grid and GridCell. Refer to the following code example that illustrates this. C# void Model_ClipboardPasted(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly if (colindex >= 0 && !treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as true for GridCell treeGrid.Model[row, col].ReadOnly = true; } } } //Set ReadOnly as True for Grid treeGrid.ReadOnly = true; } The following screenshot displays the row to be pasted. Figure SEQ Figure \* ARABIC 1: Row to Copy The following screenshot displays the row pasted. Figure SEQ Figure \* ARABIC 2: The copied Row pasted You can refer to the following sample link to handle the copy and paste operations for the ReadOnly Grid and columns.ConclusionI hope you enjoyed learning about how to export multiple gauges in single image file.You can refer to our WPF TreeGrid feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF TreeGrid documentation to understand how to present and manipulate data. For current customers, you can check out our WPF components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WPF TreeGrid and other WPF components.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
The GridTreeControl provides support for the clipboard copy and paste operations and not for ReadOnly Grid and columns. You can achieve this by changing the read only value of the Grid and Gridcell for the readonly column at runtime by using the ClipBoardPaste and ClipBoardPasted events in the GridTreeControl.Refer to the following code example to wire the ClipboardPaste and ClipboardPasted events in the GridTreeControl.C#treeGrid.Model.ClipboardPaste += Model_ClipboardPaste; treeGrid.Model.ClipboardPasted += Model_ClipboardPasted; You need to set ReadOnly as false for both Grid and Gridcell to allow the paste operation in the ClipBoardPaste event when the Grid and Gridcell have ReadOnly as true. Please refer to the following code example that illustrates this.C#void Model_ClipboardPaste(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count. for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex. var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly. if (colindex >= 0 && treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as false for a GridCell. treeGrid.Model[row, col].ReadOnly = false; } } } //Set ReadOnly as false for Grid. treeGrid.ReadOnly = false; } The ClipboardPasted event fires after pasting the data in the GridTreeControl and you can set an actual value, True, to ReadOnly property of the Grid and GridCell. Refer to the following code example that illustrates this.C#void Model_ClipboardPasted(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly if (colindex >= 0 && !treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as true for GridCell treeGrid.Model[row, col].ReadOnly = true; } } } //Set ReadOnly as True for Grid treeGrid.ReadOnly = true; } The following screenshot displays the row to be pasted.Figure SEQ Figure \* ARABIC 1: Row to CopyThe following screenshot displays the row pasted.Figure SEQ Figure \* ARABIC 2: The copied Row pastedYou can refer to the following sample link to handle the copy and paste operations for the ReadOnly Grid and columns.ConclusionI hope you enjoyed learning about how to handle copy, paste of read only GridTreeControl in Silverlight.You can refer to our Silverlight Grid feature tourpage to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Silverlight Grid example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
The GridTreeControl provides support for the clipboard copy and paste operations and not for ReadOnly Grid and columns. You can achieve this by changing the read only value of the Grid and Gridcell for the readonly column at runtime by using the ClipBoardPaste and ClipBoardPasted events in the GridTreeControl.Refer to the following code example to wire the ClipboardPaste and ClipboardPasted events in the GridTreeControl.C#treeGrid.Model.ClipboardPaste += Model_ClipboardPaste; treeGrid.Model.ClipboardPasted += Model_ClipboardPasted; You need to set ReadOnly as false for both Grid and Gridcell to allow the paste operation in the ClipBoardPaste event when the Grid and Gridcell have ReadOnly as true. Please refer to the following code example that illustrates this.C#void Model_ClipboardPaste(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count. for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex. var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly. if (colindex >= 0 && treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as false for a GridCell. treeGrid.Model[row, col].ReadOnly = false; } } } //Set ReadOnly as false for Grid. treeGrid.ReadOnly = false; } The ClipboardPasted event fires after pasting the data in the GridTreeControl and you can set an actual value, True, to ReadOnly property of the Grid and GridCell. Refer to the following code example that illustrates this.C#void Model_ClipboardPasted(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly if (colindex >= 0 && !treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as true for GridCell treeGrid.Model[row, col].ReadOnly = true; } } } //Set ReadOnly as True for Grid treeGrid.ReadOnly = true; } The following screenshot displays the row to be pasted.Figure SEQ Figure \* ARABIC 1: Row to CopyThe following screenshot displays the row pasted. Figure SEQ Figure \* ARABIC 2: The copied Row pastedYou can refer to the following sample link to handle the copy and paste operations for the ReadOnly Grid and columns.
d T0h0e GridTre1eControl provides support for the clipboard copy and paste operations and not for ReadOnly Grid and columns. You can achieve this by changing the read only value of the Grid and Gridcell for the readonly column at runtime by using the ClipBoardPaste and ClipBoardPasted events in the GridTreeControl. Refer to the following code example to wire the ClipboardPaste and ClipboardPasted events in the GridTreeControl. C# treeGrid.Model.ClipboardPaste += Model_ClipboardPaste; treeGrid.Model.ClipboardPasted += Model_ClipboardPasted; You need to set ReadOnly as false for both Grid and Gridcell to allow the paste operation in the ClipBoardPaste event when the Grid and Gridcell have ReadOnly as true. Please refer to the following code example that illustrates this. C# void Model_ClipboardPaste(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count. for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex. var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly. if (colindex >= 0 && treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as false for a GridCell. treeGrid.Model[row, col].ReadOnly = false; } } } //Set ReadOnly as false for Grid. treeGrid.ReadOnly = false; } The ClipboardPasted event fires after pasting the data in the GridTreeControl and you can set an actual value, True, to ReadOnly property of the Grid and GridCell. Refer to the following code example that illustrates this. C# void Model_ClipboardPasted(object sender, GridCutPasteEventArgs e) { //Get and check the Row index by using RangeList. for (int row = e.RangeList.ActiveRange.Top; row <= e.RangeList.ActiveRange.Bottom; row++) { //Check the condition based on the total column count for (int col = 0; col < treeGrid.Model.ColumnCount; col++) { //Get the column index by using ResolveIndexToColumnIndex var colindex = treeGrid.Model.TreeGrid.ResolveIndexToColumnIndex(col); //Check if the column as ReadOnly if (colindex >= 0 && !treeGrid.Columns[colindex].StyleInfo.ReadOnly) { //Set ReadOnly as true for GridCell treeGrid.Model[row, col].ReadOnly = true; } } } //Set ReadOnly as True for Grid treeGrid.ReadOnly = true; } The following screenshot displays the row to be pasted. Figure SEQ Figure \* ARABIC 1: Row to Copy The following screenshot displays the row pasted. Figure SEQ Figure \* ARABIC 2: The copied Row pasted ConclusionI hope you enjoyed learning about how to round the decimal values in Chart axis.You can refer to our WPF TreeGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF TreeGrid example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Capture the clipboard operations using the PreviewKeyDown event in the SfSpreadsheet control, in which the copy/paste could be captured using the keyboard shortcuts. C# protected override void OnAttached() { //Event Subscription this.AssociatedObject.PreviewKeyDown += AssociatedObject_PreviewKeyDown; } //Event Customization private void AssociatedObject_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { //To capture the clipboard(copy/paste) opeartions if ((Keyboard.IsKeyDown(Key.LeftCtrl)) && e.Key == Key.C) { MessageBox.Show("Control+C Pressed"); } else if ((Keyboard.IsKeyDown(Key.LeftCtrl)) && e.Key == Key.V) { MessageBox.Show("Control+V Pressed"); } } View sample in GitHub
By default, SfDataGrid does not allows you to paste the records when grid is empty. You can achieve this by overriding OnAttached method in SfDataGrid class. public class SfDataGridBehavior : Behavior<SfDataGrid> { protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.GridCopyPaste = new CustomCopyPaste(this.AssociatedObject); this.AssociatedObject.SelectionController = new CustomGridSelectionController(this.AssociatedObject); this.AssociatedObject.Loaded += AssociatedObject_Loaded; } private void AssociatedObject_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { this.AssociatedObject.GetVisualContainer().PointerReleased += SfDataGridBehavior_PointerReleased; } private async void SfDataGridBehavior_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (this.AssociatedObject.View != null && this.AssociatedObject.View.Records.Count == 0) { this.AssociatedObject.Focus(Windows.UI.Xaml.FocusState.Programmatic); } }); } } View sample in GitHub.
WPF DataGrid (SfDataGrid) does not provide the support copy paste (clipboard) operations in GridTemplateColumn. You can achieve this by overriding the CopyCell method in GridCutCopyPaste class. this.SampleDataGrid.GridCopyPaste = new CustomCopyPaste(this.SampleDataGrid); public class CustomCopyPaste : GridCutCopyPaste { public CustomCopyPaste(SfDataGrid DataGrid) : base(DataGrid) { } protected override void CopyCell(object record, GridColumn column, ref System.Text.StringBuilder text) { if (this.dataGrid.View == null) return; object copyText = null; if (column is GridUnBoundColumn) { var unboundValue = this.dataGrid.GetUnBoundCellValue(column, record); copyText = unboundValue != null ? unboundValue.ToString() : string.Empty; } else { if (this.dataGrid.GridCopyOption.HasFlag(GridCopyOption.IncludeFormat)) copyText = this.dataGrid.View.GetPropertyAccessProvider().GetFormattedValue(record, column.MappingName); else if (column is GridTemplateColumn && column.MappingName == "Value") { var dataItem = record as DataItem; if (dataItem.ItemType == 1) { if (dataItem.ItemShortName <= 200) { var nameValuePair = (dataGrid.DataContext as SampleViewModel).NameValuePair; copyText = nameValuePair[dataItem.StringValue].Name; } else if (dataItem.ItemShortName <= 400) { var nameValuePair = (dataGrid.DataContext as SampleViewModel).NameValuePair1; copyText = nameValuePair[dataItem.StringValue].Name; } else { copyText = dataItem.ItemShortName.ToString() + "" + "th" + " Mango"; } } else if (dataItem.ItemType == 2) { copyText = dataItem.DateTimeValue; } else { copyText = dataItem.ItemShortName; } } else copyText = this.dataGrid.View.GetPropertyAccessProvider().GetValue(record, column.MappingName); } var copyargs = this.RaiseCopyGridCellContentEvent(column, record, copyText); if (!copyargs.Handled) { if (this.dataGrid.Columns[leftMostColumnIndex] != column || text.Length != 0) text.Append('\t'); text.Append(copyargs.ClipBoardValue); } } } View WPF DataGrid Clipboard Operation Demo in GitHub.
All the record contents will be copied to the clipboard by default when the SelectionUnit is set as Row in WPF DataGrid (SfDataGrid). You can copy the active cell value alone by using the SfDataGrid.GridCopyCellContent event. You can remove tab character from the copied data by overriding the CopyCell method in GridCutCopyPaste class. Refer to the following code example to copy the data of active cell alone. this.AssociatedObject.CopyGridCellContent += AssociatedObject_CopyGridCellContent; private void AssociatedObject_CopyGridCellContent(object sender, GridCopyPasteCellEventArgs e) { //Skip to copy contents for all the inactive cells from the selected row SfDataGrid grid = e.OriginalSender is DetailsViewDataGrid ? (SfDataGrid)e.OriginalSender : (SfDataGrid)sender; if (grid != null && grid.SelectionController != null && grid.SelectionController.CurrentCellManager != null && grid.SelectionController.CurrentCellManager.CurrentCell != null && e.Column.MappingName != grid.SelectionController.CurrentCellManager.CurrentCell.GridColumn.MappingName) { e.Handled = true; } } Refer to the following code example to remove tab character from the copied data. this.AssociatedObject.GridCopyPaste = new CustomGridCopyPaste(this.AssociatedObject); public class CustomGridCopyPaste : GridCutCopyPaste { public CustomGridCopyPaste(SfDataGrid dataGrid):base(dataGrid) { } protected override void CopyCell(object record, GridColumn column, ref StringBuilder text) { base.CopyCell(record, column, ref text); text.Replace("\t", string.Empty); } } View sample in GitHub.
Description This knowledge base explains how to copy and paste the data with cell formats and formula from one Spreadsheet to another. Solution In the below sample, external button ‘Click to Copy’ is clicked to copy data with format and formula from Spreadsheet1 using getRangeData method, and ‘Click to Paste’ button is clicked to paste it on Spreadsheet2 by using the updateData client-side method. HTML <input type="button" value="Click to Copy" id="copy" /> <div id="Spreadsheet1"></div> <input type="button" value="Click to Paste" id="paste" /> <div id="Spreadsheet2"></div> JS $("#Spreadsheet1").ejSpreadsheet({ // window.defaultData from http://js.syncfusion.com/demos/web/scripts/xljsondata.min.js file. sheets: [{ rangeSettings: [{ dataSource: window.defaultData }] }], loadComplete: "onLoadComplete" }); $("#Spreadsheet2").ejSpreadsheet({ sheets: [{ rangeSettings: [{ dataSource: window.defaultData }] }] }); Razor <input type="button" value="Click to Copy" id="copy" /> @(Html.EJ().Spreadsheet<object>("Spreadsheet1") .Sheets(sheet => { sheet.RangeSettings(range => { <!-- you can define datasource at server side. --> range.Datasource((IEnumerable<object>)ViewBag.Datasource).Add(); }).Add(); }) .ClientSideEvents( events => events.LoadComplete("onLoadComplete") ) ) <input type="button" value="Click to Paste" id="paste" /> @(Html.EJ().Spreadsheet<object>("Spreadsheet2") .Sheets(sheet => { sheet.RangeSettings(range => { <!-- you can define datasource at server side. --> range.Datasource((IEnumerable<object>)ViewBag.Datasource).Add(); }).Add(); }) ) ASPX <input type="button" value="Click to Copy" id="copy" /> <ej:Spreadsheet ID="Spreadsheet1" runat="server"> <ClientSideEvents LoadComplete="onLoadComplete" /> <Sheets> <ej:Sheet> <RangeSettings> <!-- you can define datasource at server side. --> <ej:RangeSetting StartCell="A1" ShowHeader="true" /> </RangeSettings> </ej:Sheet> </Sheets> </ej:Spreadsheet> <input type="button" value="Click to Paste" id="paste" /> <ej:Spreadsheet ID="Spreadsheet2" runat="server"> <Sheets> <ej:Sheet> <RangeSettings> <!-- you can define datasource at server side. --> <ej:RangeSetting StartCell="A1" ShowHeader="true" /> </RangeSettings> </ej:Sheet> </Sheets> </ej:Spreadsheet> var range, data, spreadsheetID = "Spreadsheet"; //Tigger after loading Spreadsheet1.To apply Format and formula in Spreadsheet1. function onLoadComplete(args) { var xlEdit = this.XLEdit; xlEdit.updateValue('C2', '=SQRT(25)'); xlEdit.updateValue('C3', '=SUM(25,5)'); this.XLFormat.format({ style: { "background-color": "#C0C0C0" } }, "C1:D4"); this.XLSelection.selectRange("C1:D4"); } //Trigger while clicking the copy button. $("#copy").click(function () { var excelObj = $("#" + spreadsheetID + "1").data("ejSpreadsheet"); range = excelObj.getSheet(excelObj.getActiveSheetIndex()).selectedRange; data = excelObj.getRangeData({ range: range, property: ["value", "value2", "type", "formatStr", "decimalPlaces", "thousandSeparator", "range", "format", "border", "wrap", "formats"] }); // to get the copied data. }); //Trigger while clicking the paste button. $("#paste").click(function () { var excelObj = $("#" + spreadsheetID + "2").data("ejSpreadsheet"); if (range) { var sheetIndex = excelObj.getActiveSheetIndex(), actRange = excelObj.getActiveCell(sheetIndex), selectedCells, rowDiff = range[2] - range[0], colDiff = range[3] - range[1], pasteRange = [actRange.rowIndex, actRange.colIndex, actRange.rowIndex + rowDiff, actRange.colIndex + colDiff]; excelObj.XLSelection.selectRange(pasteRange); // select the pasted range. selectedCells = excelObj.XLSelection.getSelectedCells(sheetIndex); for (var i = 0; i < selectedCells.length; i++) { cell = selectedCells[i]; rowIndex = parseInt(cell.parentElement.getAttribute('data-idx')); colIndex = cell.cellIndex; excelObj.updateData([data[i]], [rowIndex, colIndex, rowIndex, colIndex]); // To paste the copied cells. } excelObj.updateFormulaBar(); } }); The below screenshots display the result of above code example, Figure: Spreadsheet1 Figure: Spreadsheet2
Clipboard operation To copy the selected record, use the ClipboardCopy event in WinForms GridGroupingControl. The selected row can be obtained by using the CurrentRecord property. The record values can be obtained by using the GetValue method. The retrieved data can be stored in the clipboard using the SetDataObject method. Code snippet C# this.gridGroupingControl1.TableModel.ClipboardCopy += TableModel_ClipboardCopy; private Record copiedRecord; void TableModel_ClipboardCopy(object sender, GridCutPasteEventArgs e) { String value=string.Empty; copiedRecord = this.gridGroupingControl1.Table.CurrentRecord; foreach (GridVisibleColumnDescriptor column in this.gridGroupingControl1.TableDescriptor.VisibleColumns) { value += copiedRecord.GetValue(column.Name).ToString()+"\t"; } Clipboard.SetDataObject(new DataObject(value),true); e.Handled = true; } VB Private Me.gridGroupingControl1.TableModel.ClipboardCopy += AddressOf TableModel_ClipboardCopy Private copiedRecord As Record Private Sub TableModel_ClipboardCopy(ByVal sender As Object, ByVal e As GridCutPasteEventArgs) Dim value As String=String.Empty copiedRecord = Me.gridGroupingControl1.Table.CurrentRecord For Each column As GridVisibleColumnDescriptor In Me.gridGroupingControl1.TableDescriptor.VisibleColumns value &= copiedRecord.GetValue(column.Name).ToString()+Constants.vbTab Next column Clipboard.SetDataObject(New DataObject(value),True) e.Handled = True End Sub Sample links: C#: Copy_PasteVB: Copy_PasteReference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/clipboard-operationsConclusionI hope you enjoyed learning about how to Copy selected records to clipboard in WinForms GridGroupingControl.You can refer to our WinForms GridControl feature tour page to learn about its other groundbreaking feature representations. You can also explore our WinForms GridControl documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
SfSpreadsheet provides support to paste the values alone without any formatting by using DefaultPasteOption property which enables the user to set their default PasteOptions while pasting. To paste the value alone without any formatting, use the following code example C# Spreadsheet.CopyPaste.DefaultPasteOption = PasteOptions.Value; Conclusion I hope you enjoyed learning about how to paste the values without formatting in UWP Spreadsheet.You can refer to our UWP Spreadsheet feature tour page to know about its other groundbreaking feature representations. You can also explore our UWP Spreadsheet documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
SfSpreadsheet provides support to paste the values alone without any formatting by using DefaultPasteOption property which enables the user to set their default PasteOptions while pasting. To paste the value alone without any formatting, use the following code example C# Spreadsheet.CopyPaste.DefaultPasteOption = PasteOptions.Value;
In GridControl, to copy the contents of header cell like normal cell, we need to set the HeaderRows and HeaderColumns as zero. Users can have the header like behavior by setting the FrozenRows and FrozenColumns count and set the CellType as Static for that Frozen cells like the below code example In MainWindow.xaml.cs file, C# grid.Model.HeaderColumns = 0; grid.Model.HeaderRows = 0; grid.Model.FrozenRows = 1; grid.Model.FrozenColumns = 1; grid.Model.Options.CopyPasteOption = CopyPaste.CopyText | CopyPaste.PasteText; grid.QueryCellInfo += new GridQueryCellInfoEventHandler(grid_QueryCellInfo); void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Style.ColumnIndex == 0 || e.Style.RowIndex == 0) { e.Style.CellType = "Static"; if (e.Style.RowIndex == 0) e.Style.CellValue = e.Style.ColumnIndex; else e.Style.CellValue = e.Style.RowIndex; } } Please find the sample for your reference, WPF
SfSpreadsheet provides support to paste the values alone without any formatting by using DefaultPasteOption property which enables the user to set their default PasteOptions while pasting. To paste the value alone without any formatting, use the following code example C# Spreadsheet.CopyPaste.DefaultPasteOption = PasteOptions.Value; Conclusion I hope you enjoyed learning about how to paste the values without formatting in WPF Spreadsheet.You can refer to our WPF Spreadsheet feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Spreadsheet documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Clipboard operation SfSpreadsheet provides support to paste the values alone without any formatting by using DefaultPasteOption property which enables the user to set their default PasteOptions while pasting. To paste the value alone without any formatting, use the following code example, C# Spreadsheet.CopyPaste.DefaultPasteOption = PasteOptions.Value; Reference link: https://help.syncfusion.com/windowsforms/spreadsheet/interactive-features
SfSpreadsheet provides support to copy the values in a formula cell instead of formula by overriding the Copy method of SpreadsheetCopyPaste Class. In the sample, create a CustomCopyPaste class inherited from SpreadsheetCopyPaste class and override the Copy method like below code example. C# public class CustomCopyPaste : SpreadsheetCopyPaste { public SfSpreadsheet spreadSheet { get; set; } public CustomCopyPaste(SfSpreadsheet spread) : base() { spreadSheet = spread; } public override void Copy() { var copyRange = spreadSheet.ActiveGrid.SelectedRanges.ActiveRange; var excelSourceRange = copyRange.ConvertGridRangeToExcelRange(spreadSheet.ActiveGrid); SourceWorkbookRange = spreadSheet.ActiveGrid.Worksheet.Range[excelSourceRange]; CopyClipboard(copyRange); SourceGrid = spreadSheet.ActiveGrid; } public void CopyClipboard(GridRangeInfo copyRange) { var sb = new StringBuilder(); for (int i = copyRange.Top; i <= copyRange.Bottom; i++) { for (int j = copyRange.Left; j <= copyRange.Right; j++) { sb.Append(SourceWorkbookRange[i, j].DisplayText); if (j != copyRange.Right) sb.Append("\t"); } if (i != copyRange.Bottom) sb.Append("\r\n"); } var data = new DataObject(); if (sb.Length == 0) { sb.Append(" "); } data.SetText(sb.ToString()); Clipboard.SetDataObject(data); sb.Clear(); } } In the above code example, the copied range’s DisplayText is copied to the Clipboard instead of Value. Please find the sample link for your reference, WPF WinRT UWP
SfSpreadsheet provides support to copy the values in a formula cell instead of formula by overriding the Copy method of SpreadsheetCopyPaste Class. In the sample, create a CustomCopyPaste class inherited from SpreadsheetCopyPaste class and override the Copy method like below code example. C# public class CustomCopyPaste : SpreadsheetCopyPaste { public SfSpreadsheet spreadSheet { get; set; } public CustomCopyPaste(SfSpreadsheet spread) : base() { spreadSheet = spread; } public override void Copy() { var copyRange = spreadSheet.ActiveGrid.SelectedRanges.ActiveRange; var excelSourceRange = copyRange.ConvertGridRangeToExcelRange(spreadSheet.ActiveGrid); SourceWorkbookRange = spreadSheet.ActiveGrid.Worksheet.Range[excelSourceRange]; CopyClipboard(copyRange); SourceGrid = spreadSheet.ActiveGrid; } public void CopyClipboard(GridRangeInfo copyRange) { var sb = new StringBuilder(); for (int i = copyRange.Top; i <= copyRange.Bottom; i++) { for (int j = copyRange.Left; j <= copyRange.Right; j++) { sb.Append(SourceWorkbookRange[i, j].DisplayText); if (j != copyRange.Right) sb.Append("\t"); } if (i != copyRange.Bottom) sb.Append("\r\n"); } var data = new DataObject(); if (sb.Length == 0) { sb.Append(" "); } data.SetText(sb.ToString()); Clipboard.SetDataObject(data); sb.Clear(); } } In the above code example, the copied range’s DisplayText is copied to the Clipboard instead of Value. Please find the sample link for your reference, WPF WinRT UWP ConclusionI hope you enjoyed learning about how to copy a cell value instead of formula in Spreadsheet.You can refer to our UWP Spreadsheet feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
SfSpreadsheet provides support to copy the values in a formula cell instead of formula by overriding the Copy method of SpreadsheetCopyPaste Class. In the sample, create a CustomCopyPaste class inherited from SpreadsheetCopyPaste class and override the Copy method like below code example. C# public class CustomCopyPaste : SpreadsheetCopyPaste { public SfSpreadsheet spreadSheet { get; set; } public CustomCopyPaste(SfSpreadsheet spread) : base() { spreadSheet = spread; } public override void Copy() { var copyRange = spreadSheet.ActiveGrid.SelectedRanges.ActiveRange; var excelSourceRange = copyRange.ConvertGridRangeToExcelRange(spreadSheet.ActiveGrid); SourceWorkbookRange = spreadSheet.ActiveGrid.Worksheet.Range[excelSourceRange]; CopyClipboard(copyRange); SourceGrid = spreadSheet.ActiveGrid; } public void CopyClipboard(GridRangeInfo copyRange) { var sb = new StringBuilder(); for (int i = copyRange.Top; i <= copyRange.Bottom; i++) { for (int j = copyRange.Left; j <= copyRange.Right; j++) { sb.Append(SourceWorkbookRange[i, j].DisplayText); if (j != copyRange.Right) sb.Append("\t"); } if (i != copyRange.Bottom) sb.Append("\r\n"); } var data = new DataObject(); if (sb.Length == 0) { sb.Append(" "); } data.SetText(sb.ToString()); Clipboard.SetDataObject(data); sb.Clear(); } } In the above code example, the copied range’s DisplayRange is copied to the Clipboard instead of Value. Please find the sample link for your reference, WPF WinRT UWP ConclusionI hope you enjoyed learning about how to copy a cell value instead of formula in Spreadsheet.You can refer to our WPF Spreadsheet feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Spreadsheet example to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Copy a cell value instead of formula cell WinForms Spreadsheet provides support to copy the values in a formula cell instead of formula by overriding the Copy method of SpreadsheetCopyPaste Class. In the sample, create a CustomCopyPaste class inherited from SpreadsheetCopyPaste class and override the Copy method like below code example. C# public class CustomCopyPaste : SpreadsheetCopyPaste { public Spreadsheet spreadSheet { get; set; } public CustomCopyPaste(Spreadsheet spread) : base() { spreadSheet = spread; } public override void Copy() { var copyRange = spreadSheet.ActiveGrid.SelectedRanges.ActiveRange; var excelSourceRange = copyRange.ConvertGridRangeToExcelRange(spreadSheet.ActiveGrid); SourceWorkbookRange = spreadSheet.ActiveGrid.Worksheet.Range[excelSourceRange]; CopyClipboard(copyRange); SourceGrid = spreadSheet.ActiveGrid; } public void CopyClipboard(GridRangeInfo copyRange) { var sb = new StringBuilder(); for (int i = copyRange.Top; i <= copyRange.Bottom; i++) { for (int j = copyRange.Left; j <= copyRange.Right; j++) { sb.Append(SourceWorkbookRange[i, j].DisplayText); if (j != copyRange.Right) sb.Append("\t"); } if (i != copyRange.Bottom) sb.Append("\r\n"); } var data = new DataObject(); if (sb.Length == 0) { sb.Append(" "); } data.SetText(sb.ToString()); Clipboard.SetDataObject(data); sb.Clear(); } } In the above code example, the copied range’s DisplayText is copied to the Clipboard instead of Value. Sample: WF Conclusion I hope you enjoyed learning about how to copy a cell value instead of formula in WinForms Spreadsheet (SfSpreadsheet). You can refer to our WinForms Spreadsheet’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Spreadsheet documentation to understand how to present and manipulate data. For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Spreadsheet and other WinForms components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Copy paste operation with foreign key By default, the displayed cell value can be copied and pasted in any specified cell. In foreign key cell types, the copied values are the specific value members that have a foreign key reference of an object type. For example, while pasting the string type cell values to the foreign key cell and its foreign key is in the type of integer, the FormatException is thrown. In order to copy-paste a cell value with a foreign key member field, a separate hash table instance can be used to store and retrieve the cell value from the foreign key cells and the corresponding display member values will be pasted in the required cell. This can be done through the PasteCellText event in the TableControl property. C# // Declared globally Hashtable hTable = new Hashtable(); // Form() // Trigger the required event. this.gridGroupingControl1.TableModel.PasteCellText += new GridPasteCellTextEventHandler(TableModel_PasteCellText); // Form() foreach (DataRow row in lookUpDataTable.Rows) { if (!hTable.Contains(row["CustomerName"])) hTable.Add(row["CustomerName"], row["CustomerID"]); } void TableModel_PasteCellText(object sender, GridPasteCellTextEventArgs e) { if (e.Style.CellType == "ForeignKeyCell") { e.Cancel = true; GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.RowIndex, e.ColIndex); Record rec = style.TableCellIdentity.DisplayElement.GetRecord(); rec.SetValue("Customer", hTable[e.Text].ToString()); } } VB ' Declared globally Dim hTable As New Hashtable() ' Form() ' Trigger the required event. AddHandler gridGroupingControl1.TableModel.PasteCellText, AddressOf TableModel_PasteCellText ' Form() For Each row As DataRow In lookUpDataTable.Rows If Not hTable.Contains(row("CustomerName")) Then hTable.Add(row("CustomerName"), row("CustomerID")) End If Next row void TableModel_PasteCellText(Object sender, GridPasteCellTextEventArgs e) If e.Style.CellType Is "ForeignKeyCell" Then e.Cancel = True Dim style As GridTableCellStyleInfo = Me.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.RowIndex, e.ColIndex) Dim rec As Record = style.TableCellIdentity.DisplayElement.GetRecord() rec.SetValue("Customer", hTable(e.Text).ToString()) End If Screenshot
You can paste the copied row in AddNewRow by overriding the PasteTextToRow method in GridCutCopyPaste class in WPF DataGrid (SfDataGrid). XAML <syncfusion:SfDataGrid x:Name="sfdatagrid" AddNewRowPosition="Top" AllowEditing="True" AutoGenerateColumns="True" GridCopyOption="CopyData" ItemsSource="{Binding EmployeeDetails}" SelectionMode="Extended" SelectionUnit="Row" /> C# this.sfdatagrid.GridCopyPaste = new CustomPaste(sfdatagrid); … public class CustomPaste : GridCutCopyPaste { public CustomPaste(SfDataGrid sfgrid) : base(sfgrid) { } protected override void PasteTextToRow() { IDataObject dataObject = null; dataObject = Clipboard.GetDataObject(); var clipBoardContent = dataObject.GetData(DataFormats.UnicodeText) as string; string[] records = Regex.Split(clipBoardContent.ToString(), @"\r\n"); if (dataGrid.SelectionUnit == GridSelectionUnit.Row) { dataGrid.Focus(); bool isAddNewRow= this.dataGrid.IsAddNewIndex(this.dataGrid.SelectionController.CurrentCellManager.CurrentRowColumnIndex.RowIndex); //Checking for row is AddNewRow. if (isAddNewRow) { if (!this.dataGrid.View.IsAddingNew) return; string[] record = Regex.Split(records[0], @"\t"); var provider = this.dataGrid.View.GetPropertyAccessProvider(); var rowData = (this.dataGrid.View as CollectionViewAdv).CurrentAddItem; //Paste the copied row in each cell. foreach (var column in this.dataGrid.Columns) { var cellText = provider.GetValue(rowData, column.MappingName); if (cellText == null) { PropertyDescriptorCollection typeInfos = this.dataGrid.View.GetItemProperties(); var typeInfo = typeInfos.GetPropertyDescriptor(column.MappingName); } CommitValue(rowData, column, provider, record[this.dataGrid.Columns.IndexOf(column)]); } } } else base.PasteTextToRow(); } } Note:You can only paste the copied row after initiating the AddNewRow by editing. View sample in GitHub.
Copy the table content to clipboard By default, while copying cells with hidden rows and columns in GridControl, the values of the hidden rows and columns will be copied to the clipboard. In order to copy the table content to clipboard without hidden contents, the ClipboardCopy event can be used to copy the cell content which are visible only. C# void Model_ClipboardCopy(object sender, GridCutPasteEventArgs e) { GridRangeInfo range = e.RangeList.ActiveRange; if (!range.IsEmpty) { range = range.ExpandRange(1, 1, this.gridControl1.Model.RowCount, this.gridControl1.Model.ColCount); string clipboardText = ""; GridData data = this.gridControl1.Model.Data; for (int row = range.Top; row <= range.Bottom; ++row) { if (!this.gridControl1.Model.Rows.Hidden[row]) { bool firstCol = true; for (int col = range.Left; col <= range.Right; ++col) { if (!this.gridControl1.Model.Cols.Hidden[col]) { if (!firstCol) clipboardText += "\t"; else firstCol = false; clipboardText += this.gridControl1.Model[row, col].CellValue; } } clipboardText += Environment.NewLine; } } Clipboard.SetDataObject(clipboardText); e.Handled = true; this.textBox1.Text = clipboardText; } } VB Private Sub Model_ClipboardCopy(ByVal sender As Object, ByVal e As GridCutPasteEventArgs) Dim range As GridRangeInfo = e.RangeList.ActiveRange If Not range.IsEmpty Then range = range.ExpandRange(1, 1, Me.gridControl1.Model.RowCount, Me.gridControl1.Model.ColCount) Dim clipboardText As String = "" Dim data As GridData = Me.gridControl1.Model.Data For row As Integer = range.Top To range.Bottom If Not Me.gridControl1.Model.Rows.Hidden(row) Then Dim firstCol As Boolean = True For col As Integer = range.Left To range.Right If Not Me.gridControl1.Model.Cols.Hidden(col) Then If Not firstCol Then clipboardText &= Constants.vbTab Else firstCol = False End If clipboardText &= Me.gridControl1.Model(row, col).CellValue End If Next col clipboardText &= Environment.NewLine End If Next row Clipboard.SetDataObject(clipboardText) e.Handled = True Me.textBox1.Text = clipboardText End If End Sub Samples: C#: Copy and paste_CS VB: Copy and paste_VB Reference link: https://help.syncfusion.com/windowsforms/grid-control/copy-and-paste
Resolve the copy paste issue According to Windows Forms, can’t perform the copy paste options in GridGroupingControl when the startup project is in WPF. While opening the Windows Forms form from the WPF window, the keyboard messages does not pass to the WPF window. Add the EnableWindowsFormsInterop() method in Startup event to enable the copy paste option. <Application x:Class="AutoHideDemo.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" StartupUri="Window1.xaml" Startup="Application_Startup" > To enable the Windows Forms copy, paste options, when the Startup project is WPF. C# private void Application_Startup(object sender, StartupEventArgs e) { WindowsFormsHost.EnableWindowsFormsInterop(); } VB Private Sub Application_Startup(ByVal sender As Object, ByVal e As StartupEventArgs) WindowsFormsHost.EnableWindowsFormsInterop() End Sub Samples: C#: Copy paste VB: Copy paste
The empty string will not be allowed to paste in GridCell when the SelectionUnit is Cell or Any in WPF DataGrid (SfDataGrid). But you can achieve this by overriding the PasteToRow method in GridCutCopyPaste class like below code.C# public class CustomCopyPaste : GridCutCopyPaste { public CustomCopyPaste(SfDataGrid sfgrid) : base(sfgrid) { } protected override void PasteToRow(object clipboardcontent, object selectedRecords) { if (dataGrid.SelectionUnit == GridSelectionUnit.Row) base.PasteToRow(clipboardcontent, selectedRecords); else { //Get the copied value. clipboardcontent = Regex.Split(clipboardcontent.ToString(), @"\t"); var copyValue = (string[])clipboardcontent; int cellcount = copyValue.Count(); var selectionContoller = this.dataGrid.SelectionController as GridCellSelectionController; var lastselectedindex = selectionContoller.CurrentCellManager.CurrentRowColumnIndex.ColumnIndex; //Get the PressedRowColumnIndex value using reflection from SelectionController. var PropertyInfo = (this.dataGrid.SelectionController as GridCellSelectionController).GetType().GetProperty("PressedRowColumnIndex", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); var pressedrowcolumnindex = PropertyInfo.GetValue(this.dataGrid.SelectionController); var pressedindex = ((RowColumnIndex)(pressedrowcolumnindex)).ColumnIndex; //Get the column index value that want to paste the first value. var pastecolumnindex = pressedindex < lastselectedindex ? pressedindex : lastselectedindex; int columnindex = 0; var columnStartIndex = this.dataGrid.ResolveToGridVisibleColumnIndex(pastecolumnindex); for (int i = columnStartIndex; i < cellcount + columnStartIndex; i++) { if (dataGrid.GridPasteOption.HasFlag(GridPasteOption.IncludeHiddenColumn)) { //Paste the copied value with hidden columns. if (dataGrid.Columns.Count <= i) break; PasteToCell(selectedRecords, dataGrid.Columns[i], copyValue[columnindex]); columnindex++; } else { if (dataGrid.Columns.Count <= i) break; //Paste the copied value without hidden columns. if (!dataGrid.Columns[i].IsHidden) { PasteToCell(selectedRecords, dataGrid.Columns[i], copyValue[columnindex]); columnindex++; } else cellcount++; } } } } } View sample in GitHub.
Clipboard operation In order to copy the data from one row to many rows and one column to many columns, the ClipBoardCanPaste event can be used. The target row or column range has to be given based on the Row and Column cells pasting. The data can be pasted to grid by using PasteTextFromBuffer method. C# //To paste at all the selected columns gridControl1.ClipboardCanPaste += new GridCutPasteEventHandler(gridControl1_ClipboardCanPaste); private void gridControl1_ClipboardCanPaste(object sender, GridCutPasteEventArgs e) { //For copying the data from one column to many columns. if (this.gridControl1.Model.SelectedRanges.ActiveRange.IsCols) { for (int i = this.gridControl1.Model.SelectedRanges.ActiveRange.Left; i <= this.gridControl1.Model.SelectedRanges.ActiveRange.Right; i++) { GridRangeInfo range = GridRangeInfo.Cells(1, i, this.gridControl1.RowCount, i); IDataObject iData = Clipboard.GetDataObject(); string buffer = iData.GetData(DataFormats.UnicodeText) as string; if (buffer != null) { this.gridControl1.Model.TextDataExchange.PasteTextFromBuffer(buffer, range, GridDragDropFlags.Text); } } } //For copying the data from one row to many rows. else if (this.gridControl1.Model.SelectedRanges.ActiveRange.IsRows) { for (int i = this.gridControl1.Model.SelectedRanges.ActiveRange.Top; i <= this.gridControl1.Model.SelectedRanges.ActiveRange.Bottom; i++) { GridRangeInfo range = GridRangeInfo.Cells(i, 1, i, this.gridControl1.ColCount); IDataObject iData = Clipboard.GetDataObject(); string buffer = iData.GetData(DataFormats.UnicodeText) as string; if (buffer != null) { this.gridControl1.Model.TextDataExchange.PasteTextFromBuffer(buffer, range, GridDragDropFlags.Text); } } } } VB 'To paste at all the selected columns AddHandler gridControl1.ClipboardCanPaste, AddressOf gridControl1_ClipboardCanPaste Private Sub gridControl1_ClipboardCanPaste(ByVal sender As Object, ByVal e As GridCutPasteEventArgs) ‘For copying the data from one column to many columns. If Me.gridControl1.Model.SelectedRanges.ActiveRange.IsCols Then For i As Integer = Me.gridControl1.Model.SelectedRanges.ActiveRange.Left To Me.gridControl1.Model.SelectedRanges.ActiveRange.Right Dim range As GridRangeInfo = GridRangeInfo.Cells(1, i, Me.gridControl1.RowCount, i) Dim iData As IDataObject = Clipboard.GetDataObject() Dim buffer As String = TryCast(iData.GetData(DataFormats.UnicodeText), String) If buffer IsNot Nothing Then Me.gridControl1.Model.TextDataExchange.PasteTextFromBuffer(buffer, range, GridDragDropFlags.Text) End If Next i ‘For copying the data from one row to many rows. ElseIf Me.gridControl1.Model.SelectedRanges.ActiveRange.IsRows Then For i As Integer = Me.gridControl1.Model.SelectedRanges.ActiveRange.Top To Me.gridControl1.Model.SelectedRanges.ActiveRange.Bottom Dim range As GridRangeInfo = GridRangeInfo.Cells(i, 1, i, Me.gridControl1.ColCount) Dim iData As IDataObject = Clipboard.GetDataObject() Dim buffer As String = TryCast(iData.GetData(DataFormats.UnicodeText), String) If buffer IsNot Nothing Then Me.gridControl1.Model.TextDataExchange.PasteTextFromBuffer(buffer, range, GridDragDropFlags.Text) End If Next i End If End Sub Screenshot Column based copying Row based copying Samples: C#: Copy and Paste_CS VB: Copy and Paste_VB