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. Image for the cookie policy date
close icon

Copy paste Problem in Clipboard

I want to Copy a single cell or multiple cell values of noneditable gridcontrol which has some leading spaces. Note:The problem that persisted right now was the leading spaces values are truncated and saved in a notepad. Code snippet looks like..: GridRangeInfo range = GridRangeInfo.Cell(this._lastSelectedRow, this._lastSelectedColumn); _gridControl.Selections.Add(range); _gridControl.CutPaste.CopyTextToClipboard(_gridControl.Selections.Ranges);

5 Replies

AD Administrator Syncfusion Team April 3, 2006 12:50 PM UTC

Hi Vijay, This can be achieved by using the ClipboardCopy event. In the event, get the range and the data for each cell in the range and set manually to the DataObject. Refer to the sample for more details. Sample : LeadingSpace_ClipboardCopy Best regards, Madhan


VI Vijay April 3, 2006 02:53 PM UTC

Hi Madhan, Thanks for your kindly help. How about if selection done for multiple cell clipboard copy? My Sample code looks. public void CopySelectedCellsToClipboard () { GridRangeInfoList rangeList = _gridControl.Selections.Ranges; if ( (rangeList.GetColRanges (GridRangeInfoType.Cells|GridRangeInfoType.Rows).Count != rangeList.Count) || (rangeList.GetRowRanges (GridRangeInfoType.Cells|GridRangeInfoType.Cols).Count != rangeList.Count)) { for (int i = 0; i < rangeList.Count; i++) { if (rangeList[i].IsRows ) { GridRangeInfo rangeInfo1 = rangeList[i]; GridRangeInfo rangeInfo = GridRangeInfo.Cells (rangeList[i].Top,1, rangeList[i].Bottom, _gridControl.ColCount); rangeList[i]= rangeInfo; } else if (rangeList[i].IsCols ) { GridRangeInfo rangeInfo = GridRangeInfo.Cells (1,rangeList[i].Left, _gridControl.RowCount, rangeList[i].Right ); rangeList[i]= rangeInfo; } } } if(rangeList.Count==0) { GridRangeInfo range = GridRangeInfo.Cell(this._lastSelectedRow, this._lastSelectedColumn); _gridControl.Selections.Add(range); } _gridControl.CutPaste.CopyTextToClipboard(_gridControl.Selections.Ranges); } Regards Vijay.T >Hi Vijay, > >This can be achieved by using the ClipboardCopy event. In the event, get the range and the data for each cell in the range and set manually to the DataObject. Refer to the sample for more details. > >Sample : LeadingSpace_ClipboardCopy > >Best regards, >Madhan


AD Administrator Syncfusion Team April 4, 2006 05:01 AM UTC

Hi Vijay, You can replace the CopyTextToClipboard( ) method with the code snippet provided in the sample. Here is the modified sample. Sample : Modified Sample Best regards, Madhan


VI Vijay April 4, 2006 05:45 AM UTC

Hi Madhan, Thanks a lot. Regards, Vijay.T >Hi Vijay, > >You can replace the CopyTextToClipboard( ) method with the code snippet provided in the sample. Here is the modified sample. > >Sample : Modified Sample > >Best regards, >Madhan >


AD Administrator Syncfusion Team April 4, 2006 12:11 PM UTC

Hi Vijay, Here is the updated sample. Sample : LeadingSpace_ClipboardCopy.zip Best regards, Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon