回复 2# happytc
rtf格式,特别是加入图片,是按图片BMP容量储存
代码是RICH自带的例子
测试时,在编辑加粘贴一张200K左右的图片,保存时文档可能增加1.1MB左右#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Global $lblMsg, $hRichEdit
Main()
Func Main()
Local $hGui, $iMsg
$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)
GUISetState()
For $i = 2 To 3
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Line " & $i)
Next
;$sText = ClipGet()
;_GUICtrlRichEdit_AppendText($hRichEdit, ClipGet())
Report("First visible line is number " & _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($hRichEdit))
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
;MsgBox(1,1, _GUICtrlRichEdit_StreamToVar($hRichEdit))
;ClipPut( _GUICtrlRichEdit_StreamToVar($hRichEdit))
;_GuiCtrlRichEdit_SetText($hRichEdit, "")
;Sleep(20000)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\test.rtf")
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main
Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report
|