ITextRange::GetFormattedText method (tom.h)

Gets an ITextRange object with the specified range's formatted text.

Syntax

HRESULT GetFormattedText(
  ITextRange **ppRange
);

Parameters

ppRange

Type: ITextRange**

The ITextRange object with the formatted 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 code Description
E_INVALIDARG
ppRange is null.
E_OUTOFMEMORY
Out of memory.

Remarks

This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for Applications (VBA)-friendly. The method returns the formatted text in a range. 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 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 a range2, by the formatted text in range1.

range2.FormattedText = range1.FormattedText

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

ITextRange

Reference

SetFormattedText

Text Object Model