# InsertTextFrag method

Inserts a new markup text fragment at a specified markup pointer.

## Syntax

```
HRESULT retVal = object.InsertTextFrag(iFrag, bstrInsert, pPointerInsert);

```

## Parameters

iFrag [in]

Type: long

long that specifies the index for the text fragment.

bstrInsert [in]

Type: BSTR

BSTR value that specifies the text to use for the text fragment.

pPointerInsert [in]

Type: IMarkupPointer

Pointer to an IMarkupPointer interface that specifies the location to put the new text fragment.

## Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

## Remarks

If 0 <= iFrag <= IMarkupTextFrags::GetTextFragCount, then the markup pointer for the location at which to insert the text fragment must be between the text fragments whose current indexes are iFrag - 1 and iFrag. After the fragment is inserted, the following fragment's indexes will be incremented by 1.

If iFrag = -1, the text fragment will be unconditionally placed at the markup pointer location. If there is already a text fragment at that location, the new text fragment will be placed just before it.

Show: