Windows Dev Center

ITextRange::GetFormattedText method

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 codeDescription
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

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
SetFormattedText
Conceptual
Text Object Model

 

 

Community Additions

ADD
Show:
© 2015 Microsoft