# Function Reference

# _GUICtrlRichEdit_SetParaIndents

Sets indents of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaIndents ( $hWnd [, $vLeft = Default [, $iRight = Default [, $iFirstLine = Default]]] )

## Parameters

$hWnd | Handle to the control
$vLeft | [optional] indentation of left side of the body of the paragraph (in space units) absolute - a number relative to previous - a string - "+" or "-"
$iRight | [optional] indentation of right side of the paragraph (in space units)
$iFirstLine | [optional] indentation of the first line relative to other lines (in space units)

## Return Value

Success: | True.
Failure: | False and sets the @error flag to non-zero.
@error: | 101 - $hWnd is not a handle 103 - $iRight is not a number 104 - $iFirstLine is not a number 1021 - $vLeft is neither a number nor a string consisting of a number 1022 - $vLeft would start body of paragrpah to left of client area 200 - First line would be outdented beyond the client area 700 - Operation failed

## Remarks

Postive values of $vLeft, $iRight and $iFirstLine indent towards the center of the paragraph.
All three values are initially zero.
To set "space units", call _GUICtrlRichEdit_SetSpaceUnit(). Initially inches.
If text is selected, the defaults are the values of the first paragraph with text selected.
If none is selected, the defaults are the values of the current paragraph.

## Related

_GUICtrlRichEdit_GetParaIndents, _GUICtrlRichEdit_SetSpaceUnit

## See Also

Search EM_SETPARAFORMAT in MSDN Library.

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiRichEdit.au3>
    #include <WindowsStylesConstants.au3>

    Global $g_idLbl_Msg, $g_hRichEdit

    Example()

    Func Example()
        Local $hGui, $iMsg, $idBtn_Next, $iStep = 0
        $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
        $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
                BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
        $g_idLbl_Msg = GUICtrlCreateLabel("", 10, 235, 300, 60)
        $idBtn_Next = GUICtrlCreateButton("Next", 270, 310, 40, 30)
        GUISetState(@SW_SHOW)

        _GUICtrlRichEdit_SetText($g_hRichEdit, "First paragraph")
        Report("Para with default indent settings")

        While True
            $iMsg = GUIGetMsg()
            Select
                Case $iMsg = $GUI_EVENT_CLOSE
                    _GUICtrlRichEdit_Destroy($g_hRichEdit) ; needed unless script crashes
                    ; GUIDelete()   ; is OK too
                    Exit
                Case $iMsg = $idBtn_Next
                    $iStep += 1
                    Switch $iStep
                        Case 1
                            _GUICtrlRichEdit_AppendText($g_hRichEdit, @CRLF & "Second paragraph")
                            Report("Added second paragraph")
                        Case 2
                            _GUICtrlRichEdit_SetParaIndents($g_hRichEdit, 0.25, .1)
                            Report("Changed indent settings of second paragraph")
                        Case 3
                            _GUICtrlRichEdit_SetSel($g_hRichEdit, 10, 26)
                            _GUICtrlRichEdit_SetParaIndents($g_hRichEdit, Default, 0, .2)
                            Report("Change settings of both paragraphs")
                        Case 4
                            ; Stream all text to the Desktop so you can look at Indents settings in Word
                            _GUICtrlRichEdit_Deselect($g_hRichEdit)
                            _GUICtrlRichEdit_StreamToFile($g_hRichEdit, @DesktopDir & "\gcre.rtf")
                            GUICtrlSetState($idBtn_Next, $GUI_DISABLE)
                    EndSwitch
            EndSelect
        WEnd
    EndFunc   ;==>Example

    Func Report($sMsg)
        $sMsg = $sMsg & @CRLF & @CRLF & "Get function returns " & @CRLF & _GUICtrlRichEdit_GetParaIndents($g_hRichEdit)
        GUICtrlSetData($g_idLbl_Msg, $sMsg)
    EndFunc   ;==>Report