ClipboardEx
A class providing additional methods for working with the clipboard.
Definition
Namespace:Telerik.Windows.Documents.Base
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public static class ClipboardEx
Inheritance: objectClipboardEx
Properties
Collection of ClipboardHandlers that will be used when getting rich-text content from the clipboard.
public static List<ClipboardHandler> ClipboardHandlers { get; }
The clipboard handlers.
Methods
Determines whether the clipboard contains supported rich-text data.
public static bool ContainsDocument()
true if the clipboard contains document; otherwise, false.
Determines whether the clipboard contains plain text.
Obtains a DocumentFragment from the clipboard using the registered ClipboardHandlers.
public static DocumentFragment GetDocument()
a DocumentFragment instance representing the document created from the content inside the clipboard. If the operation is not successful, the method returns null.
Obtains a DocumentFragment from the clipboard using the registered ClipboardHandlers.
public static DocumentFragment GetDocument(out PasteSource? pasteSource)
The PasteSource that is resolved during clipboard processing.
Returns:a DocumentFragment instance representing the document created from the content inside the clipboard. If the operation is not successful, the method returns null.
Gets a DocumentFragment from clipboard using the specified data format.
public static DocumentFragment GetDocumentFromClipboard(string dataFormat, Func<string, string> clipboardStringFilter = null)
dataFormat
The data format. You can use the set of formats provided in the class.
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.
<p>HTML content inserted by MS Word can be stripped using <xref href="Telerik.Windows.Documents.Base.ClipboardEx.StripHtmlClipboardFormatHeaders(System.String)" data-throw-if-not-resolved="false"></xref>.</p>
A DocumentFragment instance representing the content. If the operation did not succeed, the method return null.
Only the text, Unicode text, OEM text, RTF, HTML and XAML formats are read. For any other format the method returns null; data stored in custom clipboard formats is never deserialized.
Gets a DocumentFragment from clipboard using the specified data format.
public static DocumentFragment GetDocumentFromClipboard(string dataFormat, out PasteSource? pasteSource, Func<string, string> clipboardStringFilter = null)
dataFormat
The data format. You can use the set of formats provided in the class.
pasteSource
The PasteSource that is resolved during clipboard processing.
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.
<p>HTML content inserted by MS Word can be stripped using <xref href="Telerik.Windows.Documents.Base.ClipboardEx.StripHtmlClipboardFormatHeaders(System.String)" data-throw-if-not-resolved="false"></xref>.</p>
A DocumentFragment instance representing the content. If the operation did not succeed, the method return null.
Only the text, Unicode text, OEM text, RTF, HTML and XAML formats are read. For any other format the method returns null; data stored in custom clipboard formats is never deserialized.
Places a specified data object in the system Clipboard.
public static void SetDataObject(IDataObject dataObject)
A data object (an object that implements IDataObject) to place on the system Clipboard.
Sets a document represented by a DocumentFragment instance to the specified data object.
public static void SetDocument(DocumentFragment documentFragment, IDataObject dataObject)
The document fragment.
dataObjectIDataObjectThe object the document fragment should be inserted into.
Sets a document represented by a DocumentFragment instance to the system clipboard.
public static void SetDocument(DocumentFragment documentFragment)
The document fragment.
Stores data, specified as a string, in the specified data object.
public static void SetText(string textData, DataObject dataObject)
The string representing the text data.
dataObjectDataObjectThe data object.
Stores data, specified as a string, in the system clipboard.
Strips the clipboard format headers from the HTML content inserted in the clipboard by MS Word. Skips all lines in the beginning containing ':'.