字自动化:写RTF文本,而无需通过剪贴板会 [英] Word Automation: Write RTF text without going through clipboard
本文介绍了字自动化:写RTF文本,而无需通过剪贴板会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图按一定的 RTF字符串存储在一个变量替换在Word中的当前选择(2003/2007)
I am trying to replace the current selection in Word (2003/2007) by some RTF string stored in a variable.
下面是当前code:
Clipboard.SetText(strRTFString, TextDataFormat.Rtf)
oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0)
有没有办法做同样的事情,而不通过剪贴板去。或者是有什么办法到剪贴板中的数据推到一个安全的地方,并在其后恢复?
Is there any way to do the same thing without going through the clipboard. Or is there any way to push the clipboard data to a safe place and restore it after?
推荐答案
把RTF文件中的,而不是剪贴板中,然后从文件,例如插入。
Put the RTF in a file instead of the clipboard, then insert from the file, e.g.
Selection.InsertFile文件名:=myfile.rtf,范围:=,_
ConfirmConversions:=假,链接:=假,附件:=假
这篇关于字自动化:写RTF文本,而无需通过剪贴板会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文