ITextRange::SetFormattedText method

Sets the formatted text of this range text to the formatted text of the specified range.

Syntax


HRESULT SetFormattedText(
  [in] ITextRange *pRange
);

Parameters

pRange [in]

Type: ITextRange*

The formatted text to replace this range's text.

Return value

Type: HRESULT

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.

Return codeDescription
E_ACCESSDENIED

Text is protected.

E_INVALIDARG

pRange is null.

E_OUTOFMEMORY

Out of memory.

 

Remarks

If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.

Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the FormattedText property to replace the text in range2 with the formatted text in range1.

range2.FormattedText = range1.FormattedText

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Tom.h

DLL

Msftedit.dll

See also

Reference
ITextRange
GetDuplicate
GetFormattedText
Conceptual
Text Object Model

 

 

Show: