获获取第一个选定段落; 或者没有选择时的当前段落的编号方式类型
#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaNumbering($hWnd)
$hWnd | 控件句柄 |
成功: | 返回由分号(;)分隔的值 | |
值 1 - 字符串显示类型与启始“号码” | ||
例如:"." (加重号), "1)","(b)", "C.", "iv", "V)" | ||
段落尾部空间标志的最小间距数 | ||
特殊情况: | ||
"=" - 这一段是在前面的列表未编号的段落元素 | ||
"" - 删除所选段落的号码 | ||
值 2 - 如果是罗马体数字, 则为 "Roman", 否则为 "" | ||
值 3 - 段落间距数/项目符号 (空间单位) | ||
值 4 - 范围: | ||
a - 所有(或使用的)选定的段落进行这些设置 | ||
f - 第一选定使用这些设置,但其它不使用 | ||
c - 当前段落使用这些设置 | ||
失败: | 返回 "" ,设置@error: | |
@error: | 101 - $hWnd 参数值不是句柄 |
在MSDN中搜索
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $lblMsg, $hRichEdit
Main()
Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()
_GUICtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GUICtrlRichEdit_SetSel($hRichEdit, 0, 1)
Report("Para with default indent settings")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
_GUICtrlRichEdit_Destroy($hRichEdit) ; 除非脚本崩溃才需要
;~ GUIDelete() ; 同样行
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, ".")
Report("Added second paragraph")
Case 2
_GUICtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("Style of first paragraph in the selection")
Case 3
_GUICtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, "v) ", Default, True)
Report("Change settings of both paragraphs")
Case 4
_GUICtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, "2. ", Default, True)
Report("Changed settings for both paragraphs")
Case 5
; 把所有的文本流保存到桌面,这样您可以在 Word 中查看设置.
_GUICtrlRichEdit_Deselect($hRichEdit)
_GUICtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main
Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaNumbering($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report