Version

Working with Clipboard (XamSpreadsheet)

Purpose

This topic explains how to perform clipboard operations.

Required background

The following table lists the concept and topics required as a prerequisite to understanding this topic.

Type Content

Concept

Infragistics Excel Engine

Topic Purpose

In this section you will find information that will help you to better understand the object model and the functionalities of the Infragistics Excel Engine.

This topic explains in details the features of the XamSpreadsheet control from developer perspective.

This topic provides an overview of the visual elements of the XamSpreadsheet control.

In this topic

This topic contains the following sections:

Clipboard Introduction

Clipboard summary

The XamSpreadsheet’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 XamSpreadsheet control or MS Excel.

Cut and Copying

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 XamSpreadsheet control.

Pasting

When pasting information in the XamSpreadsheet 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 XamSpreadsheet 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.

Note
Note

When pasting simple text with merged cells completely within the target range will be unmerged.

Restrictions

The clipboard support feature of the XamSpreadsheet 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 XamSpreadsheet) 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.

Code Example: Invoking a Command

Description

The following code snippet shows how to invoke a clipboard command on the XamSpreadsheet control using a button. The code snippet assumes you have a reference to an XamSpreadsheet instance named "XamSpreadsheet1".

Code

Following is the code that implements this example.

In XAML:

<Page
  …
  xmlns:ig="http://schemas.infragistics.com/xaml"
  xmlns:igPrim="http://schemas.infragistics.com/xaml/primitives"
  …>
<Button Content="Paste"
  ig:Commanding.CommandTarget="{Binding ElementName=xamSpreadsheet1}">
  <ig:Commanding.Command>
    <igPrim:SpreadsheetCommandSource
      EventName="Click"
      CommandType="Paste" />
  </ig:Commanding.Command>
</Button>

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains the activation feature from developer perspective.

This topic explains the selection feature from developer perspective.

This topic explains how to configure and perform undo and redo operations with the control.