# Clipboard

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (2.5.0.0)

Provides methods to place data on and retrieve data from the system Clipboard. This class cannot be inherited.

{% tabs %}
{% tab title="C#" %}

```csharp
public class Clipboard
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class Clipboard
```

{% endtab %}
{% endtabs %}

## Methods

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)Clear()

Removes all data from the Clipboard.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)ContainsAudio()

Indicates whether there is data on the Clipboard in the [WaveAudio](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format.

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if there is audio data on the Clipboard; otherwise, false.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)ContainsData(format)

Indicates whether there is data on the Clipboard that is in the specified format or can be converted to that format.

| Parameter  | Type                                                                | Description                                                                                                                                                 |
| ---------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The format of the data to look for. See [DataFormats](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if there is data on the Clipboard that is in the specified *format* or can be converted to that format; otherwise, false.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)ContainsFileDropList()

Indicates whether there is data on the Clipboard that is in the [FileDrop](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if there is a file drop list on the Clipboard; otherwise, false.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)ContainsImage()

Indicates whether there is data on the Clipboard that is in the [Bitmap](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if there is image data on the Clipboard; otherwise, false.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)ContainsText()

Indicates whether there is data on the Clipboard in the [Text](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) or [UnicodeText](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) format, depending on the operating system.

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if there is text data on the Clipboard; otherwise, false.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)ContainsText(format)

Indicates whether there is text data on the Clipboard in the format indicated by the specified [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) value.

| Parameter  | Type                                                                                              | Description                                                                                                          |
| ---------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **format** | [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) | One of the [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) values. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if there is text data on the Clipboard in the value specified for *format* ; otherwise, false.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetAudioStream()

Retrieves an audio stream from the Clipboard.

**Returns:** [Stream](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream). A [Stream](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream) containing audio data or null if the Clipboard does not contain any data in the [WaveAudio](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetData(format)

Retrieves data from the Clipboard in the specified format.

| Parameter  | Type                                                                | Description                                                                                                                                                 |
| ---------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The format of the data to retrieve. See [DataFormats](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |

**Returns:** [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object). An [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) representing the Clipboard data or null if the Clipboard does not contain any data that is in the specified *format* or can be converted to that format.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetDataObject()

Retrieves the data that is currently on the system Clipboard.

**Returns:** [IDataObject](https://docs.wisej.com/api/v2.5/wisej.web/interfaces/wisej.web.idataobject). An [IDataObject](https://docs.wisej.com/api/v2.5/wisej.web/interfaces/wisej.web.idataobject) that represents the data currently on the Clipboard, or null if there is no data on the Clipboard.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetFileDropList()

Retrieves a collection of file names from the Clipboard.

**Returns:** [StringCollection](https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.stringcollection). A [StringCollection](https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.stringcollection) containing file names or null if the Clipboard does not contain any data that is in the [FileDrop](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetImage()

Retrieves an image from the Clipboard.

**Returns:** [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image). An [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) representing the Clipboard image data or null if the Clipboard does not contain any data that is in the [Bitmap](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetText()

Retrieves text data from the Clipboard in the [Text](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) or [UnicodeText](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) format, depending on the operating system.

**Returns:** [String](https://docs.microsoft.com/en-us/dotnet/api/system.string). The Clipboard text data or [Empty](https://docs.microsoft.com/en-us/dotnet/api/system.string.empty) if the Clipboard does not contain data in the [Text](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) or [UnicodeText](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) format, depending on the operating system.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)GetText(format)

Retrieves text data from the Clipboard in the format indicated by the specified [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) value.

| Parameter  | Type                                                                                              | Description                                                                                                          |
| ---------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **format** | [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) | One of the [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) values. |

**Returns:** [String](https://docs.microsoft.com/en-us/dotnet/api/system.string). The Clipboard text data or [Empty](https://docs.microsoft.com/en-us/dotnet/api/system.string.empty) if the Clipboard does not contain data in the specified format.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetAudio(audioBytes)

Saves the [Byte](https://docs.microsoft.com/en-us/dotnet/api/system.byte) array in the [WaveAudio](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format after converting it to a [Stream](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream) to the clipboard.

| Parameter      | Type                                                                | Description                                                                                        |
| -------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **audioBytes** | [Byte\[\]](https://docs.microsoft.com/en-us/dotnet/api/system.byte) | A [Byte](https://docs.microsoft.com/en-us/dotnet/api/system.byte) array containing the audio data. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *audioBytes* is null.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetAudio(audioStream)

Saves the [Stream](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream) in the [WaveAudio](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format to the clipboard.

| Parameter       | Type                                                                   | Description                                                                                         |
| --------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **audioStream** | [Stream](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream) | A [Stream](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream) containing the audio data. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *audioStream* is null.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetClientText(text)

Saves the text data to the client's temporary clipboard. Client side javascript code can copy the clipboard's content to the browser's clipboard calling Wisej.Core.copy();

| Parameter | Type                                                                | Description                                           |
| --------- | ------------------------------------------------------------------- | ----------------------------------------------------- |
| **text**  | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The text to save to the client's temporary clipboard. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *text* is null.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetData(format, data)

Saves the specified data to the clipboard in the specified format.

| Parameter  | Type                                                                | Description                                                                                                                                            |
| ---------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **format** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The format of the data to set. See [DataFormats](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |
| **data**   | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) | An [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) representing the data to add.                                                   |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *data* is null.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetDataObject(data)

Saves the specified data to the clipboard.

| Parameter | Type                                                                | Description                         |
| --------- | ------------------------------------------------------------------- | ----------------------------------- |
| **data**  | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) | The data to place on the Clipboard. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) The value of *data* is null.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetFileDropList(filePaths)

Saves the collection of file names in the [FileDrop](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format to the clipboard.

| Parameter     | Type                                                                                                            | Description                                                                                                                                  |
| ------------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **filePaths** | [StringCollection](https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.stringcollection) | A [StringCollection](https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.stringcollection) containing the file names. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *filePaths* is null.
* [ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception) *filePaths* does not contain any strings, or at least one of the strings in *filePaths* is empty, contains only white space, contains one or more invalid characters as defined by [InvalidPathChars](https://docs.microsoft.com/en-us/dotnet/api/system.io.path.invalidpathchars), is null, contains a colon (:), or exceeds the system-defined maximum length. See the [InnerException](https://docs.microsoft.com/en-us/dotnet/api/system.exception.innerexception) property of the [ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception) for more information.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetImage(image)

Saves the [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) in the [Bitmap](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.dataformats#fields) format to the clipboard

| Parameter | Type                                                                      | Description                                                                                            |
| --------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **image** | [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) | The [Image](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image) to add to the Clipboard. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *image* is null.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetText(text)

Saves the text data in the [UnicodeText](https://docs.wisej.com/api/v2.5/enumerations/wisej.web.textdataformat#fields) format to the clipboard.

| Parameter | Type                                                                | Description                       |
| --------- | ------------------------------------------------------------------- | --------------------------------- |
| **text**  | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The text to add to the Clipboard. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *text* is null or [Empty](https://docs.microsoft.com/en-us/dotnet/api/system.string.empty).

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media\&token=dc9abd99-218e-40f7-adc3-49d597c6a8fa)SetText(text, format)

Saves the text data in the format indicated by the specified [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) value to the clipboard.

| Parameter  | Type                                                                                              | Description                                                                                                          |
| ---------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **text**   | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)                               | The text to add to the Clipboard.                                                                                    |
| **format** | [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) | One of the [TextDataFormat](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.textdataformat) values. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *text* is null.
