Using Clipboard Operations

The user can cut, copy, and paste data in the control by default. You can set AutoClipboard to false to prevent this. The ClipBoardOptions property allows you to control what data is pasted by the user. If the user cuts the data before pasting, all the information is pasted.

The cut action is treated as a copy action if the user cuts the data between controls, between the control and an Excel-formatted file, or between the GcSpreadSheet control and other controls.

Copying and pasting between the control and a CSV file is only supported if the text is separated with /t.

The following conditions apply when using cut, copy, or paste:

Using Code

This example copies and pastes cell data.

CS
Copy Code
gcSpreadSheet1.AutoClipboard = true;
gcSpreadSheet1.ClipBoardOptions = GrapeCity.Xaml.SpreadSheet.Data.ClipboardPasteOptions.All;
gcSpreadSheet1.Sheets[0].Cells[0, 0].Value = "Copy";
gcSpreadSheet1.Sheets[0].Cells[1, 1].Value = "Cut";
private void Button_Click_1(object sender, RoutedEventArgs e)
  {
        GrapeCity.Xaml.SpreadSheet.Data.CellRange r;
       r = new  GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 2, 2);
       GrapeCity.Xaml.SpreadSheet.Data.CellRange r2;
       r2 = new GrapeCity.Xaml.SpreadSheet.Data.CellRange(3, 3, 2, 2);
       GrapeCity.Xaml.SpreadSheet.UI.GcSpreadSheet test;
       
       test = gcSpreadSheet1;
       test.View.ClipboardCopy(r);
       //test.View.ClipboardCut(r);
       test.View.ClipboardPaste(r2);
   }
VB
Copy Code
GcSpreadSheet1.AutoClipboard = True
GcSpreadSheet1.ClipBoardOptions = GrapeCity.Xaml.SpreadSheet.Data.ClipboardPasteOptions.All
GcSpreadSheet1.Sheets(0).Cells(0, 0).Value = "Copy"
GcSpreadSheet1.Sheets(0).Cells(1, 1).Value = "Cut"
 
    Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
        Dim r As New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 2, 2)
        Dim r2 As New GrapeCity.Xaml.SpreadSheet.Data.CellRange(3, 3, 2, 2)
        Dim test = GcSpreadSheet1
        test.View.ClipboardCopy(r)
        'test.View.ClipboardCut(r)
        test.View.ClipboardPaste(r2)
    End Sub
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.