调用ClipboardCopy/ClipboardCut/ClipboardPaste 方法就可以办到。
参看如下示例代码:
- gcSpreadSheet1.AutoClipboard = true;
- gcSpreadSheet1.ClipBoardOptions = GrapeCity.Windows.SpreadSheet.Data.ClipboardPasteOptions.All;
- gcSpreadSheet1.Sheets[0].Cells[0, 0].Value = "Copy";
- gcSpreadSheet1.Sheets[0].Cells[1, 1].Value = "Cut";
- gcSpreadSheet1.Invalidate();
- private void button1_Click(object sender, RoutedEventArgs e)
- {
- GrapeCity.Windows.SpreadSheet.Data.CellRange r;
- r = new GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 2, 2);
- GrapeCity.Windows.SpreadSheet.Data.CellRange r2;
- r2 = new GrapeCity.Windows.SpreadSheet.Data.CellRange(3, 3, 2, 2);
- GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet test;
-
- test = gcSpreadSheet1;
- test.View.ClipboardCopy(r);
- //test.View.ClipboardCut(r);
- test.View.ClipboardPaste(r2);
- gcSpreadSheet1.Invalidate();
- }
复制代码 |