Spread Windows Forms 9.0 Product Documentation
ClipboardCopy Method
Example 


Copies the contents from the sheet to the Clipboard.
Copies the contents from the sheet to the Clipboard.
Overload List
OverloadDescription
ClipboardCopy()Copies the contents from the sheet to the Clipboard.  
ClipboardCopy(ClipboardCopyOptions)Copies the contents from the sheet to the Clipboard using the specified ClipboardCopyOptions.  
ClipboardCopy(CellRange)Copies the contents from the specified CellRange in the sheet to the Clipboard.  
ClipboardCopy(CellRange,ClipboardCopyOptions)Copies the contents from the specified CellRange in the sheet to the Clipboard using the specified ClipboardCopyOptions.  
Remarks
The rich text format is not saved to the Clipboard when copying cells from Spread. If you copy the data in the rich text cell type editor, then that copies all the rich text formatting. For more information, see Setting a Rich Text Cell.
Example
This example copies data to the clipboard.
Random r = new Random();
int i, j;
DialogResult dlg;
for (i = 0; i <= 3; i++)
{
    for (j = 0; j <= 3; j++)
    {
        fpSpread1.ActiveSheet.SetValue(i, j, r.Next() -100000);
    }
}
dlg = MessageBox.Show("Do you want to copy the data to the clipboard?", "ClipboardCopy", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
    fpSpread1.ActiveSheet.AddSelection(0, 0, 3, 3);
    fpSpread1.ActiveSheet.ClipboardCopy();
}
dlg = MessageBox.Show("Do you want to paste the data from the clipboard? If yes, let's clear the data first.", "Clear", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
    fpSpread1.ActiveSheet.Cells[0, 0, 5, 5].Text = "";
}
dlg = MessageBox.Show("Now we're ready to paste!!", "ClipboardPaste", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
    fpSpread1.ActiveSheet.ClipboardPaste();
}
Dim r As New Random()
Dim i, j As Integer
Dim dlg As DialogResult
For i = 0 To 3
    For j = 0 To 3
        FpSpread1.ActiveSheet.SetValue(i, j, r.Next - 100000.ToString())
    Next j
Next i
dlg = MessageBox.Show("Do you want to copy the data to the clipboard?", "ClipboardCopy", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
    FpSpread1.ActiveSheet.AddSelection(0, 0, 3, 3)
    FpSpread1.ActiveSheet.ClipboardCopy()
End If
dlg = MessageBox.Show("Do you want to paste the data from the clipboard? If yes, let's clear the data first.", "Clear", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
    FpSpread1.ActiveSheet.Cells(0, 0, 5, 5).Text = ""
End If
dlg = MessageBox.Show("Now we're ready to paste!!", "ClipboardPaste", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
    FpSpread1.ActiveSheet.ClipboardPaste()
End If
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

SheetView Class
SheetView Members

User-Task Documentation

Customizing Clipboard Operation Options
Default Keyboard Navigation

 

 


Copyright © GrapeCity, inc. All rights reserved.