ITextRange::Copy method (tom.h)
Copies the text to a data object.
Syntax
HRESULT Copy(
VARIANT *pVar
);
Parameters
pVar
Type: VARIANT*
The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist:
- pVar->vt = (VT_UNKNOWN | VT_BYREF)
- pVar is not null
- pVar->ppunkVal is not null
Return value
Type: HRESULT
This method returns an HRESULT value. If successful, it returns S_OK. Otherwise, it returns E_OUTOFMEMORY.
Remarks
The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy, and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to reference a text solution's own internal rich text formats.
To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example:
r2.GetFormattedText = r1.GetFormattedText
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | tom.h |
DLL | Msftedit.dll |
See also
Conceptual
Reference