Click or drag to resize
TextRangeGetDataObject Method
Returns an IDataObject containing the text in the range.

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
public IDataObject GetDataObject()

Return Value

Type: IDataObject
A data object containing RTF and Unicode Text formats.
Examples
The following example demonstrates how to extract RTF text from the IDataObject obtained from a range:
C#
void GetDataObjectExample(TextRange range) {
    IDataObject data = range.GetDataObject();

    if (data.GetDataPresent(DataFormats.Rtf)) {
        Console.WriteLine(data.GetData(DataFormats.Rtf));
    }
}
See Also