private void ultraButton1_Click(object sender, EventArgs e)
{
ultraSpreadsheet1.PerformAction(UltraSpreadsheetAction.Paste);
}
This topic explains how to perform clipboard operations.
The following table lists the concept and topics required as a prerequisite to understanding this topic.
This topic contains the following sections:
The UltraSpreadsheet’s control provides Cut
, Copy
and Paste
clipboard operations allowing the user to copy information between cells, worksheets and even from and to external sources like another instance of the UltraSpreadsheet control or MS Excel.
When coping information to the clipboard the control supports the following formats:
BIFF8
CSV (comma separated values)
TSV (tab separated values)
There is also an internal format used when copying information to the clipboard and it is used when copying information between two instances of the UltraSpreadsheet control.
When pasting information in the UltraSpreadsheet the control is updating the worksheet cells depending on the formats present in the clipboard. When pasting simple text (for example from Notepad), the text is treated as tab separated values and applied to the cells relative to the upper left cell of the selection similar to how MS Excel performs that operation. The UltraSpreadsheet will attempt to parse the value for each cell to try to determine the numeric value of the string and infer the number format for the cell similar to what is done when editing a cell.
The clipboard support feature of the UltraSpreadsheet has the following restrictions:
One may not select overlapping ranges but one can select multiple ranges that share the same top row or first column and have the same height or width (for example "B2:C3,E2:G3,B7:C9,E7:G9").
Some formats (for example text/csv) will just copy the cells that represent the union of these areas into the clipboard but others (such as the internal format used for copying/pasting within a UltraSpreadsheet) will only copy the selected cells.
When selecting columns/rows, only the intersection of those selected columns/rows with some content (values or formatting) will be copied to the clipboard.
The following code snippet shows how to invoke a clipboard command on the UltraSpreadsheet control using a button. The code snippet assumes you have a reference to an UltraSpreadsheet instance named "UltraSpreadsheet1".
Following is the code that implements this example.
In C#:
private void ultraButton1_Click(object sender, EventArgs e)
{
ultraSpreadsheet1.PerformAction(UltraSpreadsheetAction.Paste);
}
In VB:
Private Sub ultraButton1_Click(sender As Object, e As EventArgs) Handles UltraButton1.Click
ultraSpreadsheet1.PerformAction(UltraSpreadsheetAction.Paste);
End Sub
The following topics provide additional information related to this topic.