如何将鼠标光标放在“插入文本”的末尾? [英] How to put mouse cursor in the end of "Inserted Text"?
本文介绍了如何将鼠标光标放在“插入文本”的末尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
(C#)
让我说,我使用以下代码以编程方式插入单词:
private void SetText(string txt){
Word.Application ap = Globals.ThisAddIn.Application;
Word.Document oDoc = ap.ActiveDocument;
object rangeStart = ap.Selection.Range.Start;
object rangeEnd = ap.Selection.Range.End;
Word.Range rng = oDoc.Range(ref rangeStart,ref rangeEnd);
rng.Text = txt;
}
然而,当我再次执行此操作时,单词会放在最后插入的单词前面...  ;
First
Second First
Third Second First
如何制作它,因为每次插入后光标都放在插入的短语旁边?
解决方案
Hello TazoTodua,
请检查以下代码是否适合您。
Word.Application ap = Globals.ThisAddIn.Application;
ap.Selection.TypeText(txt);最好的问候,
Terry
(C#)
lets say, I programatically insert word, using this code:
private void SetText(string txt){ Word.Application ap = Globals.ThisAddIn.Application; Word.Document oDoc = ap.ActiveDocument; object rangeStart = ap.Selection.Range.Start; object rangeEnd = ap.Selection.Range.End; Word.Range rng = oDoc.Range(ref rangeStart, ref rangeEnd); rng.Text = txt; }
However, when I do it again, the words are placed in front of the last inserted word...
First Second First Third Second First
how to make it , as cursor were put next to the inserted phrase after each insertion?
解决方案
Hello TazoTodua,
Please check if below code could work for you.
Word.Application ap = Globals.ThisAddIn.Application; ap.Selection.TypeText(txt);Best Regards,
Terry
这篇关于如何将鼠标光标放在“插入文本”的末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文