skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class ClipboardEx

A class providing additional methods for working with the clipboard.

Inheritance
System.Object
ClipboardEx
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.WinForms.Documents.Base
Assembly: Telerik.WinControls.RichTextEditor.dll

Syntax

public static class ClipboardEx

Properties

ClipboardHandlers

Collection of ClipboardHandlers that will be used when getting rich-text content from the clipboard.

Declaration
public static List<ClipboardHandler> ClipboardHandlers { get; }
Property Value
System.Collections.Generic.List<ClipboardHandler>

The clipboard handlers.

Methods

ContainsDocument()

Determines whether the clipboard contains supported rich-text data.

Declaration
public static bool ContainsDocument()
Returns
System.Boolean

true if the clipboard contains document; otherwise, false.

ContainsDocument(KeyEventArgs)

Determines whether the clipboard contains supported rich-text data.

Declaration
public static bool ContainsDocument(KeyEventArgs pasteKeyEventArgs)
Parameters
System.Windows.Forms.KeyEventArgs pasteKeyEventArgs

The System.Windows.Forms.KeyEventArgs instance containing the event data. The method can be safely invoked with null value for this parameter.

Returns
System.Boolean

true if the clipboard contains document; otherwise, false.

ContainsText(KeyEventArgs)

Determines whether the clipboard contains plain text.

Declaration
public static bool ContainsText(KeyEventArgs pasteKeyEventArgs)
Parameters
System.Windows.Forms.KeyEventArgs pasteKeyEventArgs

The System.Windows.Forms.KeyEventArgs instance containing the event data. Use null if such is not present./>

Returns
System.Boolean

true if the clipboard contains text; otherwise, false.

GetDocument()

Obtains a DocumentFragment from the clipboard using the registered ClipboardHandlers.

Declaration
public static DocumentFragment GetDocument()
Returns
DocumentFragment

a DocumentFragment instance representing the document created from the content inside the clipboard. If the operation is not successful, the method returns null.

GetDocument(out Nullable<PasteSource>)

Obtains a DocumentFragment from the clipboard using the registered ClipboardHandlers.

Declaration
public static DocumentFragment GetDocument(out PasteSource? pasteSource)
Parameters
System.Nullable<PasteSource> pasteSource

The PasteSource that is resolved during clipboard processing.

Returns
DocumentFragment

a DocumentFragment instance representing the document created from the content inside the clipboard. If the operation is not successful, the method returns null.

GetDocumentFromClipboard(String, Func<String, String>)

Gets a DocumentFragment from clipboard using the specified data format.

Declaration
public static DocumentFragment GetDocumentFromClipboard(string dataFormat, Func<string, string> clipboardStringFilter = null)
Parameters
System.String dataFormat

The data format. You can use the set of formats provided in the System.Windows.Forms.DataFormats class.

System.Func<System.String, System.String> clipboardStringFilter

A function to filter the string inside the clipboard. This function is used when the content needs to be formatted additionally before creating a document from it.

HTML content inserted by MS Word can be stripped using StripHtmlClipboardFormatHeaders(String).

Returns
DocumentFragment

A DocumentFragment instance representing the content. If the operation did not succeed, the method return null.

GetDocumentFromClipboard(String, out Nullable<PasteSource>, Func<String, String>)

Gets a DocumentFragment from clipboard using the specified data format.

Declaration
public static DocumentFragment GetDocumentFromClipboard(string dataFormat, out PasteSource? pasteSource, Func<string, string> clipboardStringFilter = null)
Parameters
System.String dataFormat

The data format. You can use the set of formats provided in the System.Windows.Forms.DataFormats class.

System.Nullable<PasteSource> pasteSource

The PasteSource that is resolved during clipboard processing.

System.Func<System.String, System.String> clipboardStringFilter

A function to filter the string inside the clipboard. This function is used when the content needs to be formatted additionally before creating a document from it.

HTML content inserted by MS Word can be stripped using StripHtmlClipboardFormatHeaders(String).

Returns
DocumentFragment

A DocumentFragment instance representing the content. If the operation did not succeed, the method return null.

GetDocumentFromClipboard(String, String, Func<String, String>)

Gets a DocumentFragment from clipboard using the specified data format.

Declaration
public static DocumentFragment GetDocumentFromClipboard(string dataFormat, string formatExtension, Func<string, string> clipboardStringFilter = null)
Parameters
System.String dataFormat

The data format. You can use the set of formats provided in the System.Windows.Forms.DataFormats class.

System.String formatExtension

This parameter is not used.

System.Func<System.String, System.String> clipboardStringFilter

A function to filter the string inside the clipboard. This function is used when the content needs to be formatted additionally before creating a document from it.

Returns
DocumentFragment

A DocumentFragment instance representing the content. If the operation did not succeed, the method return null.

GetText()

Gets the clipboard data.

Declaration
public static string GetText()
Returns
System.String

The string representing the content or System.String.Empty if there is no text in the clipboard.

GetText(KeyEventArgs)

Gets the clipboard data.

Declaration
public static string GetText(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs e

The System.Windows.Forms.KeyEventArgs instance containing the event data. Use null if such is not present./>

Returns
System.String

The string representing the content or System.String.Empty if there is no text in the clipboard.

SetDataObject(IDataObject)

Places a specified data object in the system Clipboard.

Declaration
public static void SetDataObject(IDataObject dataObject)
Parameters
System.Windows.Forms.IDataObject dataObject

A data object (an object that implements System.Windows.Forms.IDataObject) to place on the system Clipboard.

SetDocument(DocumentFragment)

Sets a document represented by a DocumentFragment instance to the system clipboard.

Declaration
public static void SetDocument(DocumentFragment documentFragment)
Parameters
DocumentFragment documentFragment

The document fragment.

SetDocument(DocumentFragment, IDataObject)

Sets a document represented by a DocumentFragment instance to the specified data object.

Declaration
public static void SetDocument(DocumentFragment documentFragment, IDataObject dataObject)
Parameters
DocumentFragment documentFragment

The document fragment.

System.Windows.Forms.IDataObject dataObject

The object the document fragment should be inserted into.

SetText(String)

Stores data, specified as a string, in the system clipboard.

Declaration
public static void SetText(string textData)
Parameters
System.String textData

The text data.

SetText(String, DataObject)

Stores data, specified as a string, in the specified data object.

Declaration
public static void SetText(string textData, DataObject dataObject)
Parameters
System.String textData

The string representing the text data.

System.Windows.Forms.DataObject dataObject

The data object.

SetText(KeyEventArgs, String)

Stores data, specified as a string, in the system clipboard.

Declaration
public static void SetText(KeyEventArgs e, string textData)
Parameters
System.Windows.Forms.KeyEventArgs e

The System.Windows.Forms.KeyEventArgs instance containing the event data. The method can be safely invoked with null value for this parameter.

System.String textData

The text data.

SetText(KeyEventArgs, String, DataObject)

Stores data, specified as a string, in the specified data object.

Declaration
public static void SetText(KeyEventArgs e, string textData, DataObject dataObject)
Parameters
System.Windows.Forms.KeyEventArgs e

The System.Windows.Forms.KeyEventArgs instance containing the event data. The method can be safely invoked with null value for this parameter.

System.String textData

The string representing the text data.

System.Windows.Forms.DataObject dataObject

The data object.

StripHtmlClipboardFormatHeaders(String)

Strips the clipboard format headers from the HTML content inserted in the clipboard by MS Word. Skips all lines in the beginning containing ':'.

Declaration
public static string StripHtmlClipboardFormatHeaders(string clipboardText)
Parameters
System.String clipboardText

The clipboard text.

Returns
System.String

The stripped HTML string.

Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.